change the default log format (#163268)

* change the default log format

* also change in file log

* fix compilation
This commit is contained in:
Sandeep Somavarapu
2022-10-11 16:30:41 +02:00
committed by GitHub
parent 2149a31611
commit adefb9aae2
2 changed files with 4 additions and 2 deletions
+2 -2
View File
@@ -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));
});
+2
View File
@@ -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) {