Skip to content
Snippets Groups Projects
Commit 522f7dde authored by michael.minelli's avatar michael.minelli
Browse files

Winston => Change format

parent 6166c894
No related branches found
No related tags found
No related merge requests found
...@@ -13,14 +13,17 @@ const levels = { ...@@ -13,14 +13,17 @@ const levels = {
const colors = { const colors = {
error: 'red', error: 'red',
warn : 'yellow', warn : 'orange',
info : 'green', info : 'green',
http : 'magenta', http : 'magenta',
debug: 'white' debug: 'blue'
}; };
winston.addColors(colors); winston.addColors(colors);
const format = winston.format.combine(winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss:ms' }), SharedConfig.production ? winston.format.uncolorize() : winston.format.colorize({ all: true }), winston.format.printf((info) => `${ info.timestamp } [${ process.pid }] ${ info.level }: ${ info.message }`)); const format = winston.format.combine(winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), winston.format(info => ({
...info,
level: info.level.toUpperCase()
}))(), SharedConfig.production ? winston.format.uncolorize() : winston.format.colorize({ all: true }), winston.format.prettyPrint(), winston.format.errors({ stack: true }), winston.format.align(), winston.format.printf((info) => `[${ info.timestamp }] (${ process.pid }) ${ info.level } ${ info.message } ${ info.metadata ? `\n${ JSON.stringify(info.metadata) }` : '' } ${ info.stack ? `\n${ info.stack }` : '' } `));
const commonTransportOptions = { const commonTransportOptions = {
handleRejections: true, handleRejections: true,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment