2016-06-18 21:53:18 +02:00
|
|
|
'use strict';
|
2016-10-26 10:43:11 +02:00
|
|
|
|
2016-06-18 21:53:18 +02:00
|
|
|
const log4js = require('log4js');
|
2016-11-10 21:46:37 +01:00
|
|
|
log4js.configure({
|
|
|
|
appenders: [
|
|
|
|
{ type: 'console' },
|
|
|
|
]
|
|
|
|
});
|
2014-10-20 13:03:43 +02:00
|
|
|
|
2016-06-18 21:53:18 +02:00
|
|
|
const logger = log4js.getLogger('unleash');
|
2015-03-10 16:30:56 +01:00
|
|
|
|
|
|
|
// TODO: make level configurable
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
|
|
logger.setLevel(log4js.levels.ERROR);
|
2015-12-01 11:56:53 +01:00
|
|
|
} else if (process.env.NODE_ENV === 'test') {
|
|
|
|
logger.setLevel(log4js.levels.ERROR);
|
2015-03-10 16:30:56 +01:00
|
|
|
} else {
|
|
|
|
logger.setLevel(log4js.levels.DEBUG);
|
|
|
|
}
|
|
|
|
|
2015-12-01 11:56:53 +01:00
|
|
|
module.exports = logger;
|