<commit_before>(function(def){
  def('flog', [], function() {

    // actual code...
    var EMPTY = function () {};
    var levels = {
      'all': true
    , 'info': true
    , 'warn': true
    , 'error': true
    , 'silent': true
    , 'quiet': true
    };

    function bindConsole(methodName) {
      if (console && console[methodName] && console[methodName].bind) {
        return console[methodName].bind(console);
      } else {
        return EMPTY;
      }
    }

    // deal with IE8 & IE9's weird console.log (typeof == 'object')...
    // http://whattheheadsaid.com/2011/04/internet-explorer-9s-problematic-console-object
    if (Function.prototype.bind && console && typeof console.log === "object") {
      var logMethods = ["log", "info", "warn", "error", "assert", "dir", "clear", "profile", "profileEnd", "trace"];

      try {
        // IE9
        logMethods.forEach(function (method) {
          console[method] = this.call(console[method], console);
        }, Function.prototype.bind);
      } catch(e) {
        // IE8
        function fixIe8(method) {
          console[method] = Function.prototype.call.bind(console[method], console);
        }
        for (var i = 0; i < logMethods.length; i++) {
          fixIe8(logMethods[i]);
        }
      }
    }

    // returns flog. Can be used as flog or as an instance
    return {
      level: 'quiet',
      log: EMPTY,
      info: EMPTY,
      warn: EMPTY,
      error: EMPTY,

      create: function () {
        function F() {}
        F.prototype = this;
        return new F();
      },

      setLevel: function (level) {
        if (level in levels) {
          if (level === 'all') this.level = 'info';
          else if (level === 'silent') this.level = 'quiet';
          else this.level = level;
        }
        else this.level = 'quiet';

        switch (this.level) {
          case 'info':
          case 'all':
            this.log = bindConsole('log');
            this.info = bindConsole('info');
            /* falls through */
          case 'warn':
            this.warn = bindConsole('warn');
            /* falls through */
          case 'error':
            this.error = bindConsole('error');
            break;
          default:
            this.log = this.info = this.warn = this.error = EMPTY;
        }

        return this;
      }
    };

  });
}(
  // wrapper to run code everywhere
  (function () {
    var def;

    // AMD
    if (typeof define === 'function' && define.amd) {
      def = function (name, deps, factory) {
        define(deps, factory);
      };
    // CJS/node.js
    } else if (typeof require === 'function' && typeof module !== 'undefined' && module.exports) {
       def = function (deps, factory) {<commit_msg>setLevel resets all to quiet before rebinding<commit_after>(function(def){
  def('flog', [], function() {

    // actual code...
    var EMPTY = function () {};
    var levels = {
      'all': true
    , 'info': true
    , 'warn': true
    , 'error': true
    , 'silent': true
    , 'quiet': true
    };

    function bindConsole(methodName) {
      if (console && console[methodName] && console[methodName].bind) {
        return console[methodName].bind(console);
      } else {
        return EMPTY;
      }
    }

    // deal with IE8 & IE9's weird console.log (typeof == 'object')...
    // http://whattheheadsaid.com/2011/04/internet-explorer-9s-problematic-console-object
    if (Function.prototype.bind && console && typeof console.log === "object") {
      var logMethods = ["log", "info", "warn", "error", "assert", "dir", "clear", "profile", "profileEnd", "trace"];

      try {
        // IE9
        logMethods.forEach(function (method) {
          console[method] = this.call(console[method], console);
        }, Function.prototype.bind);
      } catch(e) {
        // IE8
        function fixIe8(method) {
          console[method] = Function.prototype.call.bind(console[method], console);
        }
        for (var i = 0; i < logMethods.length; i++) {
          fixIe8(logMethods[i]);
        }
      }
    }

    // returns flog. Can be used as flog or as an instance
    return {
      level: 'quiet',
      log: EMPTY,
      info: EMPTY,
      warn: EMPTY,
      error: EMPTY,

      create: function () {
        function F() {}
        F.prototype = this;
        return new F();
      },

      setLevel: function (level) {
        if (level in levels) {
          if (level === 'all') this.level = 'info';
          else if (level === 'silent') this.level = 'quiet';
          else this.level = level;
        }
        else this.level = 'quiet';

        // reset all log methods to silent
        this.log = this.info = this.warn = this.error = EMPTY;

        switch (this.level) {
          case 'info':
          case 'all':
            this.log = bindConsole('log');
            this.info = bindConsole('info');
            /* falls through */
          case 'warn':
            this.warn = bindConsole('warn');
            /* falls through */
          case 'error':
            this.error = bindConsole('error');
            break;
        }

        return this;
      }
    };

  });
}(
  // wrapper to run code everywhere
  (function () {
    var def;

    // AMD
    if (typeof define === 'function' && define.amd) {
      def = function (name, deps, factory) {
        define(deps, factory);
      };
    // CJS/node.js
    } else if (typeof require === 'function' && typeof module !== 'undefined' && module.exports) {
       def = function (deps, factory) {
{'fraction_non_alphanumeric': 0.1539989167719805, 'fraction_numerical': 0.005055064090991154, 'mean_word_length': 1.829417773237998, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6967933', 'n_tokens_mistral': 1682, 'n_tokens_neox': 1634, 'n_words': 419}