1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-02 08:40:08 +01:00

wire up updater logger

This commit is contained in:
Kyle Spearrin 2018-02-23 23:27:20 -05:00
parent 546d1e91e2
commit 27046cb38e
4 changed files with 32 additions and 1 deletions

View File

@ -11,8 +11,8 @@ import { DesktopPlatformUtilsService } from '../../services/desktopPlatformUtils
import { DesktopRendererMessagingService } from '../../services/desktopRendererMessaging.service';
import { DesktopRendererSecureStorageService } from '../../services/desktopRendererSecureStorage.service';
import { DesktopStorageService } from '../../services/desktopStorage.service';
import { LogService } from '../../services/log.service';
import { I18nService } from '../../services/i18n.service';
import { LogService } from '../../services/log.service';
import { AuthGuardService } from './auth-guard.service';
import { BroadcasterService } from './broadcaster.service';

View File

@ -7,6 +7,7 @@ import {
import { autoUpdater } from 'electron-updater';
import { Main } from '../main';
import { UpdaterLogger } from '../scripts/updaterLogger';
import {
isAppImage,
isDev,
@ -24,6 +25,8 @@ export class UpdaterMain {
private canUpdate = false;
constructor(private main: Main) {
autoUpdater.logger = new UpdaterLogger(main.logService);
const linuxCanUpdate = process.platform === 'linux' && isAppImage();
const windowsCanUpdate = process.platform === 'win32' && !isWindowsStore() && !isWindowsPortable();
const macCanUpdate = process.platform === 'darwin' && !isMacAppStore();

View File

@ -0,0 +1,23 @@
import { Logger } from 'electron-updater';
import { LogService } from 'jslib/abstractions/log.service';
export class UpdaterLogger implements Logger {
constructor(private logService: LogService) { }
debug(message: string): void {
this.logService.debug(message);
}
info(message?: any): void {
this.logService.info(message);
}
warn(message?: any): void {
this.logService.warning(message);
}
error(message?: any): void {
this.logService.error(message);
}
}

View File

@ -9,6 +9,11 @@ import { LogService as LogServiceAbstraction } from 'jslib/abstractions/log.serv
export class LogService implements LogServiceAbstraction {
constructor(private filter: (level: LogLevelType) => boolean = null, logDir: string = null) {
if (log.transports == null) {
return;
}
log.transports.file.level = 'info';
if (logDir != null) {
log.transports.file.file = path.join(logDir, 'app.log');
}