<commit_before>export class Logger {
   static _level: number = 0;
   static LOG_ALL = 64;
   static LOG_INFO = 32;
   static LOG_WARN = 16;
   static LOG_ERROR = 8;
   static LOG_NOTHING = 0;

   static set level(value) {
      let num = parseInt(value);
      num = num === NaN ? 0 : num;
      Logger._level = num;
   }

   static log(line, obj?) {
      if (Logger._level >= Logger.LOG_ALL) {
         Logger._log(line, obj);
      }
   }

   static error(line, obj?) {
      if (Logger._level >= Logger.LOG_ERROR) {
         Logger._log("ERROR: " + line, obj);
      }
   }

   static info(line, obj?) {
      if (Logger._level >= Logger.LOG_INFO) {
         Logger._log("INFO: " + line, obj);
      }
   }

   static warn(line, obj?) {
      if (Logger._level >= Logger.LOG_WARN) {
         Logger._log("WARN: " + line, obj);
      }
   }

   private static  _log(line, obj?) {
      if (obj) {
         console.log(line, obj);
      } else {
         console.log(line);
      }
   }
}<commit_msg>Refactor logger so it shows line numbers and file<commit_after>export class Logger {
   static LOG_ALL = 64;
   static LOG_INFO = 32;
   static LOG_WARN = 16;
   static LOG_ERROR = 8;
   static LOG_NOTHING = 0;
   private static _broken = false;

   static noop() {};

   static log: Function = Logger.noop;
   static error: Function = Logger.noop;
   static info: Function = Logger.noop;
   static warn: Function = Logger.noop;

   static set level(value) {
      let num = parseInt(value);
      num = num === NaN ? 0 : num;
      if (!Logger._broken) {
         Logger.log = console.log;
         try {
            Logger.log("Setting log level");
         } catch (e) {
            Logger._broken = true;
         }
      }

      if (Logger._broken) {
         Logger.log = num >= 64 ? function() { console.log(...arguments); } : Logger.noop;
         Logger.info = num >= 32 ? function() { console.info(...arguments); } : Logger.noop;
         Logger.warn = num >= 16 ? function() { console.warn(...arguments); } : Logger.noop;
         Logger.log = num >= 8 ? function() { console.log(...arguments); } : Logger.noop;
      } else {
         // We get to keep line numbers if we do it this way.
         Logger.log = num >= 64 ? console.log : Logger.noop;
         Logger.info = num >= 32 ? console.info : Logger.noop;
         Logger.warn = num >= 16 ? console.warn : Logger.noop;
         Logger.error = num >= 8 ? console.error : Logger.noop;
      }
   }
}
{'fraction_non_alphanumeric': 0.13973268529769137, 'fraction_numerical': 0.013365735115431349, 'mean_word_length': 2.015873015873016, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '6235515', 'n_tokens_mistral': 826, 'n_tokens_neox': 765, 'n_words': 210}