{"size": 811, "ext": "js", "max_stars_repo_path": "utils/logger.js", "max_stars_repo_name": "soulkey99/youce", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "utils/logger.js", "max_issues_repo_name": "soulkey99/youce", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "utils/logger.js", "max_forks_repo_name": "soulkey99/youce", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 21.9189189189, "max_line_length": 63, "alphanum_fraction": 0.552404439}
"use strict";
/**
 * Created by MengLei on 2017-03-08.
 */

const log4js = require('log4js');
const path = require('path');
const fs = require('co-fs-extra');

const logPath = path.join(__dirname, '../public', 'logs');
fs.ensureDirSync(logPath);

let logType = !!process.env.NODE_ENV ? 'dateFile' : 'console';

log4js.configure({
    appenders: [
        {
            type: logType,
            filename: path.join(logPath, 'http.log'),
            pattern: '_MMddhh.log',
            alwaysIncludePattern: false,
            category: 'http'
        }, {
            type: 'console',
            category: 'console'
        }
    ],
    replaceConsole: true
});

let logger = log4js.getLogger('console');
logger.http = log4js.getLogger('http');

module.exports = logger;


