<commit_before>/**
 * Module dependencies.
 */
var LocalStreamer               = require('hologger-local');
var LogentriesStreamer          = require('hologger-logentries');
var ApplicationInsightsStreamer = require('hologger-applicationinsights');




/**
 * @api public
 *
 * 
 * @description
 * `Logger` constructor.
 *
 * 
 * @param {String} strategy         tipo de estrategia de logueo a emplear, esto es,
 * el cliente que se empleara (local, logentries...)
 * @param {Object} library          conjunto de pares clave-valor en que las 
 * primeras representan codigos de logueo y los segundo mensajes de texto asociados
 * a aquellos
 * @param {Number} isil             identificador numerico de la libreria
 *
 * 
 * @vid https://github.com/Automattic/mongoose/blob/master/lib/connection.js
 * @vid https://github.com/Automattic/mongoose/blob/master/lib/error.js
 * @vid https://github.com/Automattic/mongoose/blob/master/lib/error/validation.js
 * @vid https://github.com/rapid7/le_node/blob/master/src/logger.js
 * 
 */
function Logger(strategy, library, isil){
    this._library = library || {};
    this._isil = isil || null;
    this._strategy = strategy || "Local";
    this._streamers = {};
    this._streamer;

    this.init(strategy, library, isil);
}




/**
 * @api protected
 *
 *
 * @description
 * Initialize `Logger`.
 */
Logger.prototype.init = function(strategy, library, isil){
    switch (strategy) {
        case "Local": this._streamer = new LocalStreamer(library, isil); break;
        case "Logentries": this._streamer = new LogentriesStreamer(library, isil); break;
        case "ApplicationInsights": this._streamer = new ApplicationInsightsStreamer(library, isil); break;
        default: break;
    }

    this.debug      = this._streamer.debug.bind(this._streamer);
    this.info       = this._streamer.info.bind(this._streamer);
    this.notice     = this._streamer.notice.bind(this._streamer);
    this.warning    = this._streamer.warning.bind(this._streamer);
    this.error      = this._streamer.error.bind(this._streamer);<commit_msg>Pre-configura los {Streamer} en el seno de init().<commit_after>/**
 * Module dependencies.
 */
var LocalStreamer               = require('hologger-local');
var LogentriesStreamer          = require('hologger-logentries');
var ApplicationInsightsStreamer = require('hologger-applicationinsights');




/**
 * @api public
 *
 * 
 * @description
 * `Logger` constructor.
 *
 * 
 * @param {String} strategy         tipo de estrategia de logueo a emplear, esto es,
 * el cliente que se empleara (local, logentries...)
 * @param {Object} library          conjunto de pares clave-valor en que las 
 * primeras representan codigos de logueo y los segundo mensajes de texto asociados
 * a aquellos
 * @param {Number} isil             identificador numerico de la libreria
 *
 * 
 * @vid https://github.com/Automattic/mongoose/blob/master/lib/connection.js
 * @vid https://github.com/Automattic/mongoose/blob/master/lib/error.js
 * @vid https://github.com/Automattic/mongoose/blob/master/lib/error/validation.js
 * @vid https://github.com/rapid7/le_node/blob/master/src/logger.js
 * 
 */
function Logger(library, isil){
    this._library = library || {};
    this._isil = isil || null;
    this._streamers = {};
    this._streamer = null;
    this._strategy = null;

    this.init(library, isil);
}




/**
 * @api protected
 *
 *
 * @description
 * Initialize `Logger`.
 *
 * Debido al analisis y configuracion en cascada de los {Streamer}, la existencia 
 * de uno pretiere al otro. 
 */
Logger.prototype.init = function(library, isil){
    //streamer pre-definido
    this._streamers.local =  new LocalStreamer(library, isil);
    this._streamer = this._streamers.local;
    this._strategy = "Local";


    //streamers opcionales
    process.env = process.env || {};
    if (process.env.LOGENTRIES_TOKEN) {
        this._streamers.logentries = new LogentriesStreamer(library, isil);
        this._streamer = this._streamers.logentries;
        this._strategy = "Logentries";
    }
    if (process.env.APPINSIGHTS_INSTRUMENTATIONKEY)  {
        this._streamers.applicationInsights = new ApplicationInsightsStreamer(library, isil);
        this._streamer = this._streamers.applicationInsights;
        this._strategy = "ApplicationInsights";
    }


    //
    this.debug      = this._streamer.debug.bind(this._streamer);
    this.info       = this._streamer.info.bind(this._streamer);
    this.notice     = this._streamer.notice.bind(this._streamer);
    this.warning    = this._streamer.warning.bind(this._streamer);
    this.error      = this._streamer.error.bind(this._streamer);
{'fraction_non_alphanumeric': 0.12666666666666668, 'fraction_numerical': 0.00043010752688172043, 'mean_word_length': 3.178796046720575, 'pattern_counts': {'":': 3, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, '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': '292245', 'n_tokens_mistral': 1476, 'n_tokens_neox': 1449, 'n_words': 303}