<commit_before>"use strict";
var Class       = require('appolo').Class,
    path        = require('path');

module.exports = Class.define({
    $config:{
        id: 'mainLoggersFactory',
        singleton: true,
        injectorAware:true,
        properties: [
            {
                name: '_createLogger',
                factoryMethod: 'swampLogger'
            }
        ],
        inject: ['utils']
    },

    constructor: function() {
        this._loggers = null;
    },

    get:function(){

        this._initializeLoggers();

        return this._loggers;
    },

    _initializeLoggers: function() {
        if(!this._loggers) {

            //ensure log files exists
            this.utils.mkdir('logs');
            this.utils.mkfile('logs/out.log', 'w');
            this.utils.mkfile('logs/err.log', 'w');

            this._loggers = {
                out: this._createLogger({ filename: path.resolve(process.cwd(), 'logs/out.log'), json: false }),
                err: this._createLogger({ filename: path.resolve(process.cwd(), 'logs/err.log'), json: false })
            }
        }
    }


});<commit_msg>save logs in-memory for main application loggers<commit_after>"use strict";
var Class       = require('appolo').Class,
    path        = require('path');

module.exports = Class.define({
    $config:{
        id: 'mainLoggersFactory',
        singleton: true,
        injectorAware:true,
        properties: [
            {
                name: '_createLogger',
                factoryMethod: 'swampLogger'
            }
        ],
        inject: ['utils']
    },

    constructor: function() {
        this._loggers = null;
    },

    get:function(){

        this._initializeLoggers();

        return this._loggers;
    },

    _initializeLoggers: function() {
        if(!this._loggers) {

            //ensure log files exists
            this.utils.mkdir('logs');
            this.utils.mkfile('logs/out.log', 'w');
            this.utils.mkfile('logs/err.log', 'w');

            this._loggers = {
                out: this._createLogger({ filename: path.resolve(process.cwd(), 'logs/out.log'), json: false }, true, 100),
                err: this._createLogger({ filename: path.resolve(process.cwd(), 'logs/err.log'), json: false }, true, 100)
            }
        }
    }


});
{'fraction_non_alphanumeric': 0.14679294016358158, 'fraction_numerical': 0.002582866982350409, 'mean_word_length': 1.7600950118764846, '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': '955643', 'n_tokens_mistral': 678, 'n_tokens_neox': 646, 'n_words': 124}