spee.ch/server/helpers/configureLogger.js

25 lines
698 B
JavaScript
Raw Normal View History

2018-03-16 18:34:26 +01:00
const { logLevel } = require('../../config/loggerConfig');
2018-03-09 20:20:13 +01:00
module.exports = (winston) => {
// configure
winston.configure({
transports: [
new (winston.transports.Console)({
level : logLevel,
timestamp : false,
colorize : true,
prettyPrint : true,
handleExceptions : true,
humanReadableUnhandledException: true,
}),
],
});
// test all the log levels
winston.error('Level 0');
winston.warn('Level 1');
winston.info('Level 2');
winston.verbose('Level 3');
winston.debug('Level 4');
winston.silly('Level 5');
};