//https://github.com/log4js-node/log4js-node/blob/master/examples/example.js
//file: { type: 'file', filename: path.join(__dirname, 'log/file.log') }

var log4js = require("log4js");
var path = require('path');

log4js.configure({
appenders: {
  errLogs: { type: 'file', compress:true, daysToKeep: 2, maxLogSize: 1048576, backups: 1, keepFileExt: true, filename: path.join(__dirname + "/../../", 'err.txt') },
  monitorLogs: { type: 'file', compress:true, daysToKeep: 2, maxLogSize: 1048576, backups: 1, keepFileExt: true, filename: path.join(__dirname + "/../../", 'monitor.txt') },
  console: { type: 'console' }
},
categories: {
  errLogs: { appenders: ['console', 'errLogs'], level: 'error' },
  monitorLogs: { appenders: ['console', 'monitorLogs'], level: 'trace' },
  //another: { appenders: ['console'], level: 'trace' },
  default: { appenders: ['console'], level: 'trace' }
}
});

const errLogger = log4js.getLogger("errLogs");
const logger = log4js.getLogger();
const monitor = log4js.getLogger("monitorLogs");

//USAGE
//logger.debug("text")
//monitor.info('info');
//errLogger.error("some error");

module.exports =  { errLogger, logger, monitor };