Open Dipikesh opened 3 years ago
This problem still exists in version 3.8.1
This issue also causes incorrect output in https://github.com/willmorgan/winston-azure-application-insights - the AI module works but has a lookup to map winston log levels to AI log levels. If the format.colorize() option is set then the log level is not found correctly and always defaults to 1 (info). This in turn prevents exceptions being logged to AI (only trace messages with severity = information).
same in latest version 3.11.0
Apparently, you do it like this:
new winston.transports.Console({
level: "debug",
format: combine(timestamp(), prettyPrint({ depth: 4, colorize: true })),
}),
Notice the prettyPrint({ depth: 4, colorize: true })
part.
Now this doesn't do what colorize
does though. It just colors all values green.
Please tell us about your environment:
winston
version 3.3.3winston@3
node -v
outputs: v:14.15.4What is the problem?
Error response of code is including regex color code like this.
"message": "\u001b[31merror\u001b[39m"
Here is my code.
If i comment out winston.format.colorize({all:true}), the error response has no regex color code with it , it works fine but the color of logger is disappeared.
What do you expect to happen instead?
Error response should not have any color code with it and i can colorize my console log with it like this,
"message":"Error"
Other information