<commit_before>/* jshint node: true */

'use strict';

module.exports = Logger;

function Logger(logger) {
  this.logger = logger;
}

Logger.PREFIX = require('../package.json').name + ':';

Logger.prototype.info = function() {
  this.logger.info.apply(this.logger, addPrefix.apply(null, arguments));
};

Logger.prototype.error = function() {
  this.logger.error.apply(this.logger, addPrefix.apply(null, arguments));
};

function addPrefix() {
  var args = new Array(arguments.length),
      i;

  for (i = 0; i != args.length; ++i) {
    args[i] = arguments[i];
  }

  if (args.length !== 0 && args[0]) {
    args[0] = args[0] + ':';
  } else {
    args.shift();
  }
  args.unshift(Logger.PREFIX);
  return args;
}<commit_msg>Address Code Climate issues in lib/logger.js<commit_after>/* jshint node: true */

'use strict';

var scriptName = require('../package.json').name;

module.exports = Logger;

function Logger(logger) {
  this.logger = logger;
}

Logger.PREFIX = scriptName + ':';

Logger.prototype.info = function() {
  this.logger.info.apply(this.logger, addPrefix.apply(null, arguments));
};

Logger.prototype.error = function() {
  this.logger.error.apply(this.logger, addPrefix.apply(null, arguments));
};

function addPrefix() {
  var args = new Array(arguments.length),
      i;

  for (i = 0; i !== args.length; ++i) {
    args[i] = arguments[i];
  }

  if (args.length !== 0 && args[0]) {
    args[0] = args[0] + ':';
  } else {
    args.shift();
  }
  args.unshift(Logger.PREFIX);
  return args;
}
{'fraction_non_alphanumeric': 0.18692206076618229, 'fraction_numerical': 0.0066050198150594455, 'mean_word_length': 3.5770392749244713, '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': '4173993', 'n_tokens_mistral': 538, 'n_tokens_neox': 523, 'n_words': 108}