wire up updater logger
This commit is contained in:
parent
546d1e91e2
commit
27046cb38e
|
@ -11,8 +11,8 @@ import { DesktopPlatformUtilsService } from '../../services/desktopPlatformUtils
|
||||||
import { DesktopRendererMessagingService } from '../../services/desktopRendererMessaging.service';
|
import { DesktopRendererMessagingService } from '../../services/desktopRendererMessaging.service';
|
||||||
import { DesktopRendererSecureStorageService } from '../../services/desktopRendererSecureStorage.service';
|
import { DesktopRendererSecureStorageService } from '../../services/desktopRendererSecureStorage.service';
|
||||||
import { DesktopStorageService } from '../../services/desktopStorage.service';
|
import { DesktopStorageService } from '../../services/desktopStorage.service';
|
||||||
import { LogService } from '../../services/log.service';
|
|
||||||
import { I18nService } from '../../services/i18n.service';
|
import { I18nService } from '../../services/i18n.service';
|
||||||
|
import { LogService } from '../../services/log.service';
|
||||||
|
|
||||||
import { AuthGuardService } from './auth-guard.service';
|
import { AuthGuardService } from './auth-guard.service';
|
||||||
import { BroadcasterService } from './broadcaster.service';
|
import { BroadcasterService } from './broadcaster.service';
|
||||||
|
|
|
@ -7,6 +7,7 @@ import {
|
||||||
import { autoUpdater } from 'electron-updater';
|
import { autoUpdater } from 'electron-updater';
|
||||||
|
|
||||||
import { Main } from '../main';
|
import { Main } from '../main';
|
||||||
|
import { UpdaterLogger } from '../scripts/updaterLogger';
|
||||||
import {
|
import {
|
||||||
isAppImage,
|
isAppImage,
|
||||||
isDev,
|
isDev,
|
||||||
|
@ -24,6 +25,8 @@ export class UpdaterMain {
|
||||||
private canUpdate = false;
|
private canUpdate = false;
|
||||||
|
|
||||||
constructor(private main: Main) {
|
constructor(private main: Main) {
|
||||||
|
autoUpdater.logger = new UpdaterLogger(main.logService);
|
||||||
|
|
||||||
const linuxCanUpdate = process.platform === 'linux' && isAppImage();
|
const linuxCanUpdate = process.platform === 'linux' && isAppImage();
|
||||||
const windowsCanUpdate = process.platform === 'win32' && !isWindowsStore() && !isWindowsPortable();
|
const windowsCanUpdate = process.platform === 'win32' && !isWindowsStore() && !isWindowsPortable();
|
||||||
const macCanUpdate = process.platform === 'darwin' && !isMacAppStore();
|
const macCanUpdate = process.platform === 'darwin' && !isMacAppStore();
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,6 +9,11 @@ import { LogService as LogServiceAbstraction } from 'jslib/abstractions/log.serv
|
||||||
|
|
||||||
export class LogService implements LogServiceAbstraction {
|
export class LogService implements LogServiceAbstraction {
|
||||||
constructor(private filter: (level: LogLevelType) => boolean = null, logDir: string = null) {
|
constructor(private filter: (level: LogLevelType) => boolean = null, logDir: string = null) {
|
||||||
|
if (log.transports == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.transports.file.level = 'info';
|
||||||
if (logDir != null) {
|
if (logDir != null) {
|
||||||
log.transports.file.file = path.join(logDir, 'app.log');
|
log.transports.file.file = path.join(logDir, 'app.log');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue