1
0
mirror of https://github.com/mifi/lossless-cut.git synced 2024-11-22 02:12:30 +01:00

always log to console

and also allow opening log path
This commit is contained in:
Mikael Finstad 2024-04-01 13:50:59 +01:00
parent ba9c098941
commit f31d08981e
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26
2 changed files with 9 additions and 2 deletions

View File

@ -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;

View File

@ -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); },