nestjs winston日志文件是用颜色编码编写的

nestjs winston日志文件是用颜色编码编写的,nestjs,winston,express-winston,Nestjs,Winston,Express Winston,我面临着与wherelogger.info('你好,你好吗?')相同的问题是结果�[32minfo�[39m:�你好,你好吗?�[39m 我不知道colorize在哪里,所以我可以删除它,这是我的代码: new winston.transports.File({ format: winston.format.combine( winston.format.colorize({ // I added this but it's still not helping

我面临着与where
logger.info('你好,你好吗?')相同的问题是结果<代码>�[32minfo�[39m:�你好,你好吗?�[39m

我不知道
colorize
在哪里,所以我可以删除它,这是我的代码:

  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,
  }),
main.ts
中,我有

import { WINSTON_MODULE_NEST_PROVIDER } from 'nest-winston';
app.useLogger(app.get(WINSTON_MODULE_NEST_PROVIDER));
AppModule.ts
中,我有以下内容:

import { WinstonModule } from 'nest-winston';
...
    WinstonModule.forRoot({
      transports,
    }),
我找不到任何使用
colorize()
的地方,也不知道如何禁用它


我正在使用
“nest winston”:“^1.4.0”、
“winston”:“^3.3.3”、
winston.format.uncolorize()方法添加到格式化选项中,以从winston输出中去除颜色编码

  format: winston.format.combine(
     winston.format.uncolorize()
     ...

干杯

winston.format.uncolorize()方法添加到格式化选项中,以从winston输出中去除颜色编码

  format: winston.format.combine(
     winston.format.uncolorize()
     ...

干杯

非常感谢@MrARC,这回答并解决了我的问题。非常感谢@MrARC,这回答并解决了我的问题。