Electron-log setup

This commit is contained in:
Core 2022-02-04 03:33:49 +00:00
parent e9b960f71f
commit 1a1842ad41
No known key found for this signature in database
GPG key ID: FE9BF1B547F8F3C6

View file

@ -1,6 +1,7 @@
import {app, Menu, nativeImage, Tray} from 'electron'; import {app, Menu, nativeImage, Tray} from 'electron';
import * as path from 'path'; import * as path from 'path';
import {utils} from './utils' import * as log from 'electron-log';
import {utils} from './utils';
export class AppEvents { export class AppEvents {
private protocols: string[] = [ private protocols: string[] = [
@ -24,6 +25,7 @@ export class AppEvents {
* @returns {void} * @returns {void}
*/ */
private start(): void { private start(): void {
AppEvents.initLogging()
console.info('[AppEvents] App started'); console.info('[AppEvents] App started');
/********************************************************************************************************************** /**********************************************************************************************************************
@ -284,4 +286,13 @@ export class AppEvents {
]) ])
this.tray.setContextMenu(menu) this.tray.setContextMenu(menu)
} }
/**
* Initializes logging in the application
* @private
*/
private static initLogging() {
log.transports.console.format = '[{h}:{i}:{s}.{ms}] [{level}] {text}';
Object.assign(console, log.functions);
}
} }