Dom*_*Dom 1 winston nestjs express-winston
我面临与https://github.com/winstonjs/winston/issues/1416相同的问题,结果logger.info(\'Hello there. How are you?\');是\xef\xbf\xbd[32minfo\xef\xbf\xbd[39m: \xef\xbf\xbd[32mHello there. How are you?\xef\xbf\xbd[39m
我不知道在哪里colorize可以删除它,这是我的代码:
new winston.transports.File({\n format: winston.format.combine(\n winston.format.colorize({ // I added this but it\'s still not helping\n all: false,\n message: false,\n level: false,\n }),\n winston.format.label({ label: \'API\' }),\n winston.format.timestamp(),\n winston.format.printf(({ level, message, label, timestamp }) => {\n return `${timestamp} [${label}] ${level}: ${message}`;\n }),\n ),\n filename: environment.logDirectory,\n level: \'http\',\n maxsize: 1024 * 1024 * 10,\n }),\nRun Code Online (Sandbox Code Playgroud)\n在 中main.ts,我有
import { WINSTON_MODULE_NEST_PROVIDER } from \'nest-winston\';\napp.useLogger(app.get(WINSTON_MODULE_NEST_PROVIDER));\nRun Code Online (Sandbox Code Playgroud)\n在 中AppModule.ts,我有以下内容:
import { WinstonModule } from \'nest-winston\';\n...\n WinstonModule.forRoot({\n transports,\n }),\nRun Code Online (Sandbox Code Playgroud)\n我找不到任何使用它的地方colorize(),而且我不知道如何禁用它。
我正在使用"nest-winston": "^1.4.0",和"winston": "^3.3.3",
小智 7
将winston.format.uncolorize()方法添加到格式化选项中,以从winston输出中去除颜色编码
format: winston.format.combine(
winston.format.uncolorize()
...
Run Code Online (Sandbox Code Playgroud)
干杯
| 归档时间: |
|
| 查看次数: |
2552 次 |
| 最近记录: |