mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
adds logger and starts logging errors
This commit is contained in:
21
website/src/libs/api-v3/logger.js
Normal file
21
website/src/libs/api-v3/logger.js
Normal 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;
|
||||
Reference in New Issue
Block a user