mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-24 12:06:15 +01:00
[PM-3754] Update electron log (#6680)
This commit is contained in:
parent
aae9bdd586
commit
ac1ab0bdcc
@ -76,6 +76,7 @@ export class Main {
|
||||
}
|
||||
|
||||
this.logService = new ElectronLogService(null, app.getPath("userData"));
|
||||
this.logService.init();
|
||||
this.i18nService = new I18nMainService("en", "./locales/");
|
||||
|
||||
const storageDefaults: any = {};
|
||||
|
@ -8,16 +8,24 @@ import { ConsoleLogService as BaseLogService } from "@bitwarden/common/platform/
|
||||
import { isDev } from "../../utils";
|
||||
|
||||
export class ElectronLogService extends BaseLogService {
|
||||
constructor(protected filter: (level: LogLevelType) => boolean = null, logDir: string = null) {
|
||||
constructor(
|
||||
protected filter: (level: LogLevelType) => boolean = null,
|
||||
private logDir: string = null
|
||||
) {
|
||||
super(isDev(), filter);
|
||||
}
|
||||
|
||||
// Initialize the log file transport. Only needs to be done once in the main process.
|
||||
init() {
|
||||
if (log.transports == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
log.transports.file.level = "info";
|
||||
if (logDir != null) {
|
||||
log.transports.file.file = path.join(logDir, "app.log");
|
||||
if (this.logDir != null) {
|
||||
log.transports.file.resolvePathFn = () => path.join(this.logDir, "app.log");
|
||||
}
|
||||
log.initialize();
|
||||
}
|
||||
|
||||
write(level: LogLevelType, message: string) {
|
||||
|
14
package-lock.json
generated
14
package-lock.json
generated
@ -125,7 +125,7 @@
|
||||
"del": "6.1.1",
|
||||
"electron": "25.9.1",
|
||||
"electron-builder": "23.6.0",
|
||||
"electron-log": "4.4.8",
|
||||
"electron-log": "5.0.0",
|
||||
"electron-reload": "2.0.0-alpha.1",
|
||||
"electron-store": "8.1.0",
|
||||
"electron-updater": "5.3.0",
|
||||
@ -20210,10 +20210,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/electron-log": {
|
||||
"version": "4.4.8",
|
||||
"resolved": "https://registry.npmjs.org/electron-log/-/electron-log-4.4.8.tgz",
|
||||
"integrity": "sha512-QQ4GvrXO+HkgqqEOYbi+DHL7hj5JM+nHi/j+qrN9zeeXVKy8ZABgbu4CnG+BBqDZ2+tbeq9tUC4DZfIWFU5AZA==",
|
||||
"dev": true
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/electron-log/-/electron-log-5.0.0.tgz",
|
||||
"integrity": "sha512-vB3akupmQvA8jAyNL9rULZtf6WoP8vsabjXsRtiqXS6/D37SwN/4LEyj4JD+9Bv6xoTcx/LrVnsIKEEWdq5ClQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"electron": ">= 13",
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-osx-sign": {
|
||||
"version": "0.6.0",
|
||||
|
@ -89,7 +89,7 @@
|
||||
"del": "6.1.1",
|
||||
"electron": "25.9.1",
|
||||
"electron-builder": "23.6.0",
|
||||
"electron-log": "4.4.8",
|
||||
"electron-log": "5.0.0",
|
||||
"electron-reload": "2.0.0-alpha.1",
|
||||
"electron-store": "8.1.0",
|
||||
"electron-updater": "5.3.0",
|
||||
|
Loading…
Reference in New Issue
Block a user