summaryrefslogtreecommitdiffhomepage
path: root/gui/src
diff options
context:
space:
mode:
Diffstat (limited to 'gui/src')
-rw-r--r--gui/src/main/logging.ts6
-rw-r--r--gui/src/shared/logging.ts7
2 files changed, 9 insertions, 4 deletions
diff --git a/gui/src/main/logging.ts b/gui/src/main/logging.ts
index fb3730d59e..23c0f6ad1d 100644
--- a/gui/src/main/logging.ts
+++ b/gui/src/main/logging.ts
@@ -4,7 +4,7 @@ import path from 'path';
import { IpcMainEventChannel } from './ipc-event-channel';
import { LogLevel, ILogInput, ILogOutput } from '../shared/logging-types';
-export const OLD_LOG_FILES = ['frontend-renderer.log'];
+export const OLD_LOG_FILES = ['main.log', 'renderer.log'];
export class FileOutput implements ILogOutput {
private fileDescriptor: number;
@@ -37,11 +37,11 @@ export class IpcInput implements ILogInput {
}
export function getMainLogPath() {
- return path.join(getLogDirectoryDir(), 'main.log');
+ return path.join(getLogDirectoryDir(), 'frontend-main.log');
}
export function getRendererLogPath() {
- return path.join(getLogDirectoryDir(), 'renderer.log');
+ return path.join(getLogDirectoryDir(), 'frontend-renderer.log');
}
export function createLoggingDirectory(): void {
diff --git a/gui/src/shared/logging.ts b/gui/src/shared/logging.ts
index 43d0b271d9..84eaa5f25c 100644
--- a/gui/src/shared/logging.ts
+++ b/gui/src/shared/logging.ts
@@ -14,7 +14,8 @@ export class Logger {
public log(level: LogLevel, ...data: unknown[]) {
const time = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
- const message = `[${time}][${LogLevel[level]}] ${data.join(' ')}`;
+ const stringifiedData = data.map(this.stringifyData).join(' ');
+ const message = `[${time}][${LogLevel[level]}] ${stringifiedData}`;
this.outputMessage(level, message);
}
@@ -29,6 +30,10 @@ export class Logger {
this.outputs.forEach((output) => output.dispose?.());
}
+ private stringifyData(data: unknown): string {
+ return typeof data === 'string' ? data : JSON.stringify(data);
+ }
+
private outputMessage(level: LogLevel, message: string) {
this.outputs
.filter((output) => level <= output.level)