2015-10-29 16:36:44 +01:00
|
|
|
var winston = require('winston');
|
|
|
|
var logger = new winston.Logger({ exitOnError: true });
|
|
|
|
|
|
|
|
var logLevel = process.env.PITAYA_LOG_LEVEL || 'info';
|
|
|
|
var logFile = process.env.PITAYA_LOG_FILE;
|
|
|
|
|
|
|
|
logger.level = logLevel;
|
|
|
|
|
2015-10-30 12:01:44 +01:00
|
|
|
logger.add(winston.transports.Console, {
|
|
|
|
colorize: true,
|
|
|
|
handleExceptions: true,
|
|
|
|
humanReadableUnhandledException: true
|
|
|
|
});
|
2015-10-29 16:36:44 +01:00
|
|
|
|
|
|
|
if(logFile) {
|
|
|
|
logger.add(winston.transports.File, {
|
|
|
|
filename: logFile,
|
2015-10-30 12:01:44 +01:00
|
|
|
json: false,
|
|
|
|
handleExceptions: true,
|
|
|
|
humanReadableUnhandledException: true
|
2015-10-29 16:36:44 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = logger;
|