<commit_before>var winston = require('winston');

var logger = function(api, next){

  var transports = [], i;
  for(i in api.config.logger.transports){
    var t = api.config.logger.transports[i];
    if(typeof t == 'function'){
      transports.push(t(api, winston));
    } else {
      transports.push(t);
    }
  }

  api.logger = new (winston.Logger)({
    // TODO We need to manually make these levels until winston switches the order back
    levels: {
      emerg: 7,
      alert: 6,
      crit: 5,
      error: 4,
      warning: 3,
      notice: 2,
      info: 1,
      debug: 0
    },
    transports: transports
  });

  if(api.config.logger.levels != null){
    api.logger.setLevels(winston.config.syslog.levels);
  }

  api.log = function(message, severity, data){
    if(severity == null || api.logger.levels[severity] == null){ severity = 'info' }
    if(data != null){
      api.logger.log(severity, message, data);
    } else {
      api.logger.log(severity, message);
    }
  }

  var logLevels = [];
  for(i in api.logger.levels){ logLevels.push(i) }
<commit_msg>Added support for winston's string interpolation<commit_after>var winston = require('winston');

var logger = function(api, next){

  var transports = [], i;
  for(i in api.config.logger.transports){
    var t = api.config.logger.transports[i];
    if(typeof t == 'function'){
      transports.push(t(api, winston));
    } else {
      transports.push(t);
    }
  }

  api.logger = new (winston.Logger)({
    // TODO We need to manually make these levels until winston switches the order back
    levels: {
      emerg: 7,
      alert: 6,
      crit: 5,
      error: 4,
      warning: 3,
      notice: 2,
      info: 1,
      debug: 0
    },
    transports: transports
  });

  if(api.config.logger.levels != null){
    api.logger.setLevels(winston.config.syslog.levels);
  }

  api.log = function(message, severity){
    if(severity == null || api.logger.levels[severity] == null){ severity = 'info' }
    var args = [ severity, message ];
    args.push.apply(args, Array.prototype.slice.call(arguments, 2));
    api.logger.log.apply(api.logger, args);
  }

  var logLevels = [];
  for(i in api.logger.levels){ logLevels.push(i) }

{'fraction_non_alphanumeric': 0.1482150926344329, 'fraction_numerical': 0.0076818798011748755, 'mean_word_length': 2.714765100671141, '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': '5358282', 'n_tokens_mistral': 804, 'n_tokens_neox': 739, 'n_words': 177}