<commit_before>'use strict';

var util = require('util');

var RED     = '\x1b[31m';
var GREEN   = '\x1b[32m';
var YELLOW  = '\x1b[33m';
var BLUE    = '\x1b[34m';
var RESET   = '\x1b[0m';


function getErrorMessage(e){
  var errorStrings = ['', ''];
  
  if(typeof e === 'undefined'){
    return errorStrings;
  }
  if(typeof e === 'string' || e instanceof String){
    errorStrings[0] = ' ' + e;
    return errorStrings;
  }
  if(e instanceof Error){
    errorStrings[0] = ' ' +  e.toString();
    if (e.stack){
      errorStrings[1] = '\nStack trace: ' + e.stack;
    }
    return errorStrings;
  }
  if(e && typeof e.toString !== 'undefined'){
    errorStrings[0] = ' ' + e.toString();
  }
  errorStrings[1] = '\nObject: ' + util.inspect(e);
  return errorStrings;
};


var logger = module.exports = function logger(namespace) {
  var debug = require('debug')(namespace);
  var debugDebug = require('debug')(namespace + ':debug');
  
  return {
    debug: function(message, e){
      var errorStrings = getErrorMessage(e);
      debugDebug(BLUE + ' DEBUG  ' + RESET + message + errorStrings[0] + errorStrings[1]);
    },
    info: function(message, e){
      var errorStrings = getErrorMessage(e);
      debug(GREEN + ' INFO   ' + RESET + message + errorStrings[0] + errorStrings[1]);
    },
    warn: function(message, e){
      var errorStrings = getErrorMessage(e);
      debug(YELLOW + ' WARN   ' + RESET + message + errorStrings[0] + errorStrings[1]);
    },
    error: function(message, e){
      var errorStrings = getErrorMessage(e);
      debug(RED + ' ERROR  ' + RESET + message + errorStrings[0] + errorStrings[1]);
    }
  };
};<commit_msg>Logger: aligned debug output with the other outputs<commit_after>'use strict';

var util = require('util');

var RED     = '\x1b[31m';
var GREEN   = '\x1b[32m';
var YELLOW  = '\x1b[33m';
var BLUE    = '\x1b[34m';
var RESET   = '\x1b[0m';


function getErrorMessage(e){
  var errorStrings = ['', ''];
  
  if(typeof e === 'undefined'){
    return errorStrings;
  }
  if(typeof e === 'string' || e instanceof String){
    errorStrings[0] = ' ' + e;
    return errorStrings;
  }
  if(e instanceof Error){
    errorStrings[0] = ' ' +  e.toString();
    if (e.stack){
      errorStrings[1] = '\nStack trace: ' + e.stack;
    }
    return errorStrings;
  }
  if(e && typeof e.toString !== 'undefined'){
    errorStrings[0] = ' ' + e.toString();
  }
  errorStrings[1] = '\n  object: ' + util.inspect(e);
  return errorStrings;
};


var logger = module.exports = function logger(namespace) {
  var debug = require('debug')(namespace);
  var debugDebug = require('debug')(namespace + ':debug');
  
  return {
    debug: function(message, e){
      var errorStrings = getErrorMessage(e);
      debugDebug(BLUE + 'DEBUG  ' + RESET + message + errorStrings[0] + errorStrings[1]);
    },
    info: function(message, e){
      var errorStrings = getErrorMessage(e);
      debug(GREEN + '    INFO   ' + RESET + message + errorStrings[0] + errorStrings[1]);
    },
    warn: function(message, e){
      var errorStrings = getErrorMessage(e);
      debug(YELLOW + '    WARN   ' + RESET + message + errorStrings[0] + errorStrings[1]);
    },
    error: function(message, e){
      var errorStrings = getErrorMessage(e);
      debug(RED + '    ERROR  ' + RESET + message + errorStrings[0] + errorStrings[1]);
    }
  };
};
{'fraction_non_alphanumeric': 0.16706372840976771, 'fraction_numerical': 0.016081000595592615, 'mean_word_length': 3.116421568627451, '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': '4573761', 'n_tokens_mistral': 1153, 'n_tokens_neox': 1130, 'n_words': 256}