<commit_before>'use strict';

let define = require('../define');
let DigsObject = require('./object');
let chalk = require('chalk');
let _ = require('../utils');

const DigsLogger = define({
  refs: {
    colors: {
      debug: 'black',
      ok: 'green',
      error: 'red',
      info: 'blue',
      warn: 'yellow'
    }
  },
  init(context) {
    const instance = context.instance;
    const logMethods = _.mapValues(instance.colors,
      (color, methodName) => {
        return (data, tags) => {
          return this.log(chalk[color](data), [methodName].concat(tags || []));
        };
      });
    return _.extend(instance, logMethods);
  },
  methods: {
    log(data, tags) {
      if (!arguments.length) {
        return;
      }
      tags = [
        this.namespace,
        this.project
      ].concat(tags || []);
      this._digs.log(tags, data);
    }
  }
})
  .compose(DigsObject);

module.exports = DigsLogger;<commit_msg>simplify init<commit_after>'use strict';

let define = require('../define');
let DigsObject = require('./object');
let chalk = require('chalk');
let _ = require('../utils');

const DigsLogger = define({
  refs: {
    colors: {
      debug: 'black',
      ok: 'green',
      error: 'red',
      info: 'blue',
      warn: 'yellow'
    }
  },
  init() {
    const logMethods = _.mapValues(this.colors,
      (color, methodName) => {
        return (data, tags) => {
          return this.log(chalk[color](data), [methodName].concat(tags || []));
        };
      });
    return _.extend(this, logMethods);
  },
  methods: {
    log(data, tags) {
      if (!arguments.length) {
        return;
      }
      tags = [
        this.namespace,
        this.project
      ].concat(tags || []);
      this._digs.log(tags, data);
    }
  }
})
  .compose(DigsObject);

module.exports = DigsLogger;
{'fraction_non_alphanumeric': 0.17798466593647316, 'fraction_numerical': 0.0, 'mean_word_length': 2.268336314847943, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3671121', 'n_tokens_mistral': 597, 'n_tokens_neox': 588, 'n_words': 119}