I have the below code
const {
colorize,
combine,
json,
printf,
simple,
timestamp,
errors,
metadata
} = winston.format;
private readonly consoleLogger = new winston.transports.Console({
format: combine(
errors({ stack: true }),
metadata(),
timestamp(),
colorize({ all: true }),
simple(),
printf((info) => {
const { level, message } = info;
if (info?.metadata?.stackTrace) {
return `[${level}] ${message}\r\n${info.metadata.stackTrace}`;
}
return `[${level}] ${message}`;
})
)
});
Based on docs and examples seems colorize will change the color of the whole line. I was wondering how can I colorize different part of string for example in my code I want timestamp, Level and message have different colors like image below