always log to console

and also allow opening log path
pull/1946/head
Mikael Finstad 2024-04-01 13:50:59 +01:00
rodzic ba9c098941
commit f31d08981e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 25AB36E3E81CBC26
2 zmienionych plików z 9 dodań i 2 usunięć

Wyświetl plik

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

Wyświetl plik

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