From adefb9aae27c2a3ffbba2d6b3a70091f73fb3fba Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 11 Oct 2022 16:30:41 +0200 Subject: [PATCH] change the default log format (#163268) * change the default log format * also change in file log * fix compilation --- src/vs/platform/log/common/fileLog.ts | 4 ++-- src/vs/platform/log/node/spdlogLog.ts | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/vs/platform/log/common/fileLog.ts b/src/vs/platform/log/common/fileLog.ts index 0be7b474679..dbb5c57cc98 100644 --- a/src/vs/platform/log/common/fileLog.ts +++ b/src/vs/platform/log/common/fileLog.ts @@ -21,7 +21,7 @@ export class FileLogger extends AbstractLogger implements ILogger { private backupIndex: number = 1; constructor( - private readonly name: string, + name: string, private readonly resource: URI, level: LogLevel, private readonly donotUseFormatters: boolean, @@ -101,7 +101,7 @@ export class FileLogger extends AbstractLogger implements ILogger { if (this.donotUseFormatters) { content += message; } else { - content += `[${this.getCurrentTimestamp()}] [${this.name}] [${this.stringifyLogLevel(level)}] ${message}\n`; + content += `${this.getCurrentTimestamp()} [${this.stringifyLogLevel(level)}] ${message}\n`; } await this.fileService.writeFile(this.resource, VSBuffer.fromString(content)); }); diff --git a/src/vs/platform/log/node/spdlogLog.ts b/src/vs/platform/log/node/spdlogLog.ts index af7a576df1c..b00a30a3dbf 100644 --- a/src/vs/platform/log/node/spdlogLog.ts +++ b/src/vs/platform/log/node/spdlogLog.ts @@ -15,6 +15,8 @@ async function createSpdLogLogger(name: string, logfilePath: string, filesize: n const logger = await _spdlog.createAsyncRotatingLogger(name, logfilePath, filesize, filecount); if (donotUseFormatters) { logger.clearFormatters(); + } else { + logger.setPattern('%Y-%m-%d %H:%M:%S.%e [%l] %v'); } return logger; } catch (e) {