mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-23 22:27:06 +00:00
chore: Upgrade winston dependency and remove unused modules
This commit is contained in:
parent
3a63896e40
commit
1bc1968f3a
2 changed files with 18 additions and 36 deletions
|
|
@ -83,9 +83,7 @@
|
|||
"validator": "~4.2.1",
|
||||
"vinyl-buffer": "^1.0.0",
|
||||
"vinyl-source-stream": "^1.1.0",
|
||||
"winston": "~0.8.0",
|
||||
"winston-mail": "~0.2.9",
|
||||
"winston-newrelic": "~0.1.4"
|
||||
"winston": "^2.1.0"
|
||||
},
|
||||
"private": true,
|
||||
"engines": {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
var nconf = require('nconf');
|
||||
var winston = require('winston');
|
||||
require('winston-mail').Mail;
|
||||
// require('winston-newrelic');
|
||||
|
||||
var logger, loggly;
|
||||
|
||||
|
|
@ -22,52 +20,38 @@ if (nconf.get('LOGGLY:enabled')){
|
|||
});
|
||||
}
|
||||
|
||||
if (logger == null) {
|
||||
logger = new (winston.Logger)({});
|
||||
if (nconf.get('NODE_ENV') == 'production') {
|
||||
// logger.add(winston.transports.newrelic, {});
|
||||
if (!nconf.get('DISABLE_ERROR_EMAILS')) {
|
||||
logger.add(winston.transports.Mail, {
|
||||
to: nconf.get('ADMIN_EMAIL') || nconf.get('SMTP_USER'),
|
||||
from: "HabitRPG <" + nconf.get('SMTP_USER') + ">",
|
||||
subject: "HabitRPG Error",
|
||||
host: nconf.get('SMTP_HOST'),
|
||||
port: nconf.get('SMTP_PORT'),
|
||||
tls: nconf.get('SMTP_TLS'),
|
||||
username: nconf.get('SMTP_USER'),
|
||||
password: nconf.get('SMTP_PASS'),
|
||||
level: 'error'
|
||||
});
|
||||
}
|
||||
} else {
|
||||
logger.add(winston.transports.Console, {colorize:true});
|
||||
logger.add(winston.transports.File, {filename: 'habitrpg.log'});
|
||||
}
|
||||
if (!logger) {
|
||||
logger = new (winston.Logger)({});
|
||||
|
||||
if (nconf.get('NODE_ENV') !== 'production') {
|
||||
logger.add(winston.transports.Console, {colorize:true});
|
||||
logger.add(winston.transports.File, {filename: 'habitrpg.log'});
|
||||
}
|
||||
}
|
||||
|
||||
// A custom log function that wraps Winston. Makes it easy to instrument code
|
||||
// and still possible to replace Winston in the future.
|
||||
module.exports.log = function(/* variable args */) {
|
||||
if (logger)
|
||||
logger.log.apply(logger, arguments);
|
||||
if (logger)
|
||||
logger.log.apply(logger, arguments);
|
||||
};
|
||||
|
||||
module.exports.info = function(/* variable args */) {
|
||||
if (logger)
|
||||
logger.info.apply(logger, arguments);
|
||||
if (logger)
|
||||
logger.info.apply(logger, arguments);
|
||||
};
|
||||
|
||||
module.exports.warn = function(/* variable args */) {
|
||||
if (logger)
|
||||
logger.warn.apply(logger, arguments);
|
||||
if (logger)
|
||||
logger.warn.apply(logger, arguments);
|
||||
};
|
||||
|
||||
module.exports.error = function(/* variable args */) {
|
||||
if (logger)
|
||||
logger.error.apply(logger, arguments);
|
||||
if (logger)
|
||||
logger.error.apply(logger, arguments);
|
||||
};
|
||||
|
||||
module.exports.loggly = function(/* variable args */){
|
||||
if (loggly)
|
||||
loggly.log.apply(loggly, arguments);
|
||||
if (loggly)
|
||||
loggly.log.apply(loggly, arguments);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue