I am developing a Node.js application, using babel-cli as an ES6 transpiler and I am using Winston 3.0 as my logging service.
Question:
I want the whole output of the messages from the winston logger to appear in color, not just the label and the message, but the timestamp as well. I know that, in Winston 2.x that was in some ways possible (don't know how though).
I have already tried different NPM Packages like winston color and winston-console-formatter, but they don't seem to work.
I have defined my logger as follows:
import winston from 'winston'
let alignColorsAndTime = winston.format.combine(
winston.format.colorize({
all:true
}),
winston.format.label({
label:'[LOGGER]'
}),
winston.format.timestamp({
format:"YY-MM-DD HH:MM:SS"
}),
winston.format.printf(
info => ` ${info.label} ${info.timestamp} ${info.level} : ${info.message}`
)
);
export const logger = winston.createLogger({
level: "debug",
transports: [
new (winston.transports.Console)({
format: alignColorsAndTime
})
],
});