I am facing the same issue as https://github.com/winstonjs/winston/issues/1416 where logger.info('Hello there. How are you?');
is resulting �[32minfo�[39m: �[32mHello there. How are you?�[39m
I don't know where colorize
is so that I can remove it, here is my code:
new winston.transports.File({
format: winston.format.combine(
winston.format.colorize({ // I added this but it's still not helping
all: false,
message: false,
level: false,
}),
winston.format.label({ label: 'API' }),
winston.format.timestamp(),
winston.format.printf(({ level, message, label, timestamp }) => {
return `${timestamp} [${label}] ${level}: ${message}`;
}),
),
filename: environment.logDirectory,
level: 'http',
maxsize: 1024 * 1024 * 10,
}),
In main.ts
, I have
import { WINSTON_MODULE_NEST_PROVIDER } from 'nest-winston';
app.useLogger(app.get(WINSTON_MODULE_NEST_PROVIDER));
In AppModule.ts
, I have the following:
import { WinstonModule } from 'nest-winston';
...
WinstonModule.forRoot({
transports,
}),
I can't find anywhere that uses colorize()
and I don't know how can I disable it.
I am using "nest-winston": "^1.4.0",
and "winston": "^3.3.3",
Add winston.format.uncolorize() method to the formatting options to strip color encoding from your winston output
format: winston.format.combine(
winston.format.uncolorize()
...
Cheers