<commit_before>/**
 * logging
 */

(function() {

    // error management
    cdb.core.Error = Backbone.Model.extend({
        url: cdb.config.REPORT_ERROR_URL,
        initialize: function() {
            this.set({browser: JSON.stringify($.browser) });
        }
    });

    cdb.core.ErrorList = Backbone.Collection.extend({
        model: cdb.core.Error,
        enableTrack: function() {
          var old_onerror = window.onerror;
          window.onerror = function(msg, url, line) {
              cdb.errors.create({
                  msg: msg,
                  url: url,
                  line: line
              });
              if (old_onerror)
                old_onerror.apply(window, arguments);
          };
        }
    });

    /** contains all error for the application */
    cdb.errors = new cdb.core.ErrorList();


    // error tracking!
    if(cdb.config.ERROR_TRACK_ENABLED) {
      cdb.errors.enableTrack();
    }


    // logging
    var _fake_console = function() {};
    _fake_console.prototype.error = function(){};
    _fake_console.prototype.log= function(){};

    //IE7 love
    if(typeof console !== "undefined") {
        _console = console;
        try {
          _console.log.apply(_console, ['cartodb.js ' + cartodb.VERSION])
        } catch(e) {
          _console = new _fake_console();
        }
    } else {
        _console = new _fake_console();
    }

    cdb.core.Log = Backbone.Model.extend({

        error: function() {
            _console.error.apply(_console, arguments);
            if(cdb.config.ERROR_TRACK_ENABLED) {
              cdb.errors.create({
                  msg: Array.prototype.slice.call(arguments).join('')
              });
            }
        },

        log: function() {
            _console.log.apply(_console, arguments);
        },

        info: function() {
            _console.log.apply(_console, arguments);
        },

        debug: function() {
            _console.log.apply(_console, arguments);
        }
    });

})();

cdb.log = new cdb.core.Log({tag: 'cdb'});<commit_msg>enabled debug log only on debug<commit_after>/**
 * logging
 */

(function() {

    // error management
    cdb.core.Error = Backbone.Model.extend({
        url: cdb.config.REPORT_ERROR_URL,
        initialize: function() {
            this.set({browser: JSON.stringify($.browser) });
        }
    });

    cdb.core.ErrorList = Backbone.Collection.extend({
        model: cdb.core.Error,
        enableTrack: function() {
          var old_onerror = window.onerror;
          window.onerror = function(msg, url, line) {
              cdb.errors.create({
                  msg: msg,
                  url: url,
                  line: line
              });
              if (old_onerror)
                old_onerror.apply(window, arguments);
          };
        }
    });

    /** contains all error for the application */
    cdb.errors = new cdb.core.ErrorList();


    // error tracking!
    if(cdb.config.ERROR_TRACK_ENABLED) {
      cdb.errors.enableTrack();
    }


    // logging
    var _fake_console = function() {};
    _fake_console.prototype.error = function(){};
    _fake_console.prototype.log= function(){};

    //IE7 love
    if(typeof console !== "undefined") {
        _console = console;
        try {
          _console.log.apply(_console, ['cartodb.js ' + cartodb.VERSION])
        } catch(e) {
          _console = new _fake_console();
        }
    } else {
        _console = new _fake_console();
    }

    cdb.core.Log = Backbone.Model.extend({

        error: function() {
            _console.error.apply(_console, arguments);
            if(cdb.config.ERROR_TRACK_ENABLED) {
              cdb.errors.create({
                  msg: Array.prototype.slice.call(arguments).join('')
              });
            }
        },

        log: function() {
            _console.log.apply(_console, arguments);
        },

        info: function() {
            _console.log.apply(_console, arguments);
        },

        debug: function() {
          if (cdb.DEBUG) _console.log.apply(_console, arguments);
        }
    });

})();

cdb.log = new cdb.core.Log({tag: 'cdb'});
{'fraction_non_alphanumeric': 0.1375089992800576, 'fraction_numerical': 0.00047996160307175426, 'mean_word_length': 1.6700832799487508, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6838095', 'n_tokens_mistral': 1241, 'n_tokens_neox': 1208, 'n_words': 212}