<commit_before>'use strict';

var colors = require('colors'),
    util = require('util'),
    q = require('q');

/**
 * ConsoleTransport class. Transport for the console.
 * @param {Object}  configs An object containing configurations to initialize the Transport
 * @param {Array}   configs.levels A list of levels that the transport has to log. By default every message are logged at each level
 * @param {Boolean} configs.timestamp Flag to allow timestamp in the log. True by default
 * @param {Boolean} configs.colorize Flag to allow colors in the log. True by default
 * @param {Object}  configs.colors A map of level-color. Each level is logged colored by his color
 * @returns {ConsoleTransport} A new ConsoleTransport instance
 * @constructor
 */
function ConsoleTransport (configs) {
    var me = this;

    configs = configs || {};
    me.levels = configs.levels || [];
    me.timestamp = configs.timestamp || true;
    me.colorize = configs.colorize || true;
    me.colors = {
        info: 'green',
        warning: 'yellow',
        error: 'red'
    };

    if (configs.colors) {
        me.colors = configs.colors;
        colors.setTheme(me.colors);
    }

    /**<commit_msg>added semantic methods<commit_after>'use strict';

var colors = require('colors'),
    util = require('util'),
    q = require('q');

/**
 * ConsoleTransport class. Transport for the console.
 * @param {Object}  configs An object containing configurations to initialize the Transport
 * @param {Array}   configs.levels A list of levels that the transport has to log. By default every message are logged at each level
 * @param {Boolean} configs.timestamp Flag to allow timestamp in the log. True by default
 * @param {Boolean} configs.colorize Flag to allow colors in the log. True by default
 * @param {Object}  configs.colors A map of level-color. Each level is logged colored by his color
 * @returns {ConsoleTransport} A new ConsoleTransport instance
 * @constructor
 */
function ConsoleTransport (configs) {
    var me = this;

    configs = configs || {};
    me.levels = configs.levels || ['info', 'warning', 'error'];
    me.timestamp = configs.timestamp || true;
    me.colorize = configs.colorize || true;
    me.colors = {
        info: 'green',
        warning: 'yellow',
        error: 'red'
    };

    if (configs.colors) {
        me.colors = configs.colors;
        colors.setTheme(me.colors);
    }

    me.levels.forEach(function (level) {
        me[level] = function (message, metadata, callback) {
            return me.log(level, message, metadata, callback);
        };
    });

    /**
{'fraction_non_alphanumeric': 0.11384615384615385, 'fraction_numerical': 0.0, 'mean_word_length': 3.089622641509434, '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': '1383167', 'n_tokens_mistral': 728, 'n_tokens_neox': 710, 'n_words': 265}