adds logger and starts logging errors

This commit is contained in:
Matteo Pagliazzi
2015-11-03 17:47:16 +01:00
parent 5f3e798016
commit 5e73bc9f1c
3 changed files with 30 additions and 3 deletions

View File

@@ -0,0 +1,21 @@
'use strict';
// Logger utility
// TODO remove winston-mail and winston-newrelic if not used
let winston = require('winston');
let nconf = require('nconf');
// TODO use const?
// TODO move isProd to a single location
let isProd = nconf.get('NODE_ENV') === 'production';
let logger = new winston.Logger();
if (isProd) {
// TODO production logging
} else {
logger
.add(winston.transports.Console);
}
module.exports = logger;