Skip to content

Commit 61a1805

Browse files
committed
feat: specify path to log file
1 parent 8fc890c commit 61a1805

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

electron/main/logger/logger.factory.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { app } from 'electron';
2+
import path from 'node:path';
23
import { ScopedLoggerImpl } from '../../common/logger/scoped.logger.js';
34
import type { Logger } from '../../common/logger/types.js';
45
import { JsonLogFormatterImpl } from './format/json.formatter.js';
@@ -53,14 +54,19 @@ const createConsoleTransportConfig = (): LogTransportConfig => {
5354
};
5455

5556
const createFileTransportConfig = (): LogTransportConfig => {
56-
const logsPath = app.getPath('logs');
57-
5857
return {
5958
transporter: new FileLogTransporterImpl({
60-
filePath: logsPath,
59+
filePath: getLogFilePath(),
6160
append: true,
6261
encoding: 'utf8',
6362
formatter: new JsonLogFormatterImpl(),
6463
}),
6564
};
6665
};
66+
67+
const getLogFilePath = (): string => {
68+
const appName = app.getName().toLowerCase();
69+
const logsDir = app.getPath('logs');
70+
71+
return path.join(logsDir, appName + '.log');
72+
};

0 commit comments

Comments
 (0)