diff --git a/src/main/logger.ts b/src/main/logger.ts index fafeab2..890dc41 100644 --- a/src/main/logger.ts +++ b/src/main/logger.ts @@ -29,9 +29,10 @@ const createLogger = () => winston.createLogger({ }); const logDirPath = app.isPackaged ? app.getPath('userData') : '.'; +export const logFilePath = join(logDirPath, 'app.log'); const logger = createLogger(); -logger.add(new winston.transports.File({ level: 'debug', filename: join(logDirPath, 'app.log'), options: { flags: 'a' } })); -if (!app.isPackaged) logger.add(new winston.transports.Console()); +logger.add(new winston.transports.Console()); +logger.add(new winston.transports.File({ level: 'debug', filename: logFilePath, options: { flags: 'a' }, maxsize: 1e6, maxFiles: 100, tailable: true })); export default logger; diff --git a/src/main/menu.ts b/src/main/menu.ts index 7dbdda7..938c413 100644 --- a/src/main/menu.ts +++ b/src/main/menu.ts @@ -3,6 +3,7 @@ import electron, { BrowserWindow } from 'electron'; import { t } from 'i18next'; import { homepage, getReleaseUrl, licensesPage } from './constants.js'; +import { logFilePath } from './logger.js'; // menu-safe i18n.t: @@ -424,6 +425,11 @@ export default ({ app, mainWindow, newVersion, isStoreBuild }: { click() { electron.shell.openExternal('https://github.com/mifi/lossless-cut/issues'); }, }, { type: 'separator' }, + { + label: esc(t('Log file')), + click() { electron.shell.openPath(logFilePath); }, + }, + { type: 'separator' }, { label: esc(t('Licenses')), click() { electron.shell.openExternal(licensesPage); },