<commit_before>function Logger() {
  this.enabled = true;
  this.debugging = false;
}

Logger.prototype.onBeforeLog = function() {};
Logger.prototype.onAfterLog = function() {};

Logger.prototype.log = function(msg, level) {
  if (!this.enabled) {
    return;
  }

  var dontlog = this.onBeforeLog(arguments) || false;
  if (!dontlog) {
    switch (level) {
      case 'error':
        console.error(msg);
        break;
      case 'warn':
        console.warn(msg);
        break;
      case 'info':
        console.info(msg);
        break;
      case 'log':
        console.log(msg);
        break;
      case 'debug':
        if (this.debugging) console.log(msg);
        break;
      default:
        console.log(msg);
    }
  }
  this.onAfterLog(dontlog || false, arguments);<commit_msg>some colors for logger<commit_after>function Logger() {
  this.enabled = true;
  this.debugging = false;
}

Logger.prototype.onBeforeLog = function() {};
Logger.prototype.onAfterLog = function() {};

var colors = {
  //styles
  'bold': ['\x1B[1m', '\x1B[22m'],
  'italic': ['\x1B[3m', '\x1B[23m'],
  'underline': ['\x1B[4m', '\x1B[24m'],
  'inverse': ['\x1B[7m', '\x1B[27m'],
  'strikethrough': ['\x1B[9m', '\x1B[29m'],
  //grayscale
  'white': ['\x1B[37m', '\x1B[39m'],
  'grey': ['\x1B[90m', '\x1B[39m'],
  'black': ['\x1B[30m', '\x1B[39m'],
  //colors
  'blue': ['\x1B[34m', '\x1B[39m'],
  'cyan': ['\x1B[36m', '\x1B[39m'],
  'green': ['\x1B[32m', '\x1B[39m'],
  'magenta': ['\x1B[35m', '\x1B[39m'],
  'red': ['\x1B[31m', '\x1B[39m'],
  'yellow': ['\x1B[33m', '\x1B[39m']
};

Logger.prototype.log = function(msg, level) {
  if (!this.enabled) {
    return;
  }

  var dontlog = this.onBeforeLog(arguments) || false;
  if (!dontlog) {
    switch (level) {
      case 'error':
        console.error(colors.red[0] + '[ERROR] ' + colors.red[1] + msg);
        break;
      case 'warn':
        console.warn(colors.yellow[0] + '[WARNING] ' + msg + colors.yellow[1]);
        break;
      case 'info':
        console.info(colors.cyan[0] + '[INFO] ' + colors.cyan[1] + msg);
        break;
      case 'debug':
        if (this.debugging) console.log(colors.magenta[0] + '[DEBUG] ' + colors.magenta[1] + msg);
        break;
      default:
        console.log(msg);
    }
  }
  this.onAfterLog(dontlog || false, arguments);
{'fraction_non_alphanumeric': 0.21237024221453288, 'fraction_numerical': 0.03762975778546713, 'mean_word_length': 2.7548701298701297, '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': '2303781', 'n_tokens_mistral': 934, 'n_tokens_neox': 904, 'n_words': 159}