From 1e70139a8e70a224a2acfa152e2b8a0766042821 Mon Sep 17 00:00:00 2001 From: jojohoch <joachim.hoch@iqb.hu-berlin.de> Date: Wed, 6 Oct 2021 09:25:43 +0200 Subject: [PATCH] [player] Re-enable console logging in debug mode Console logging is disabled in production mode by overriding the function in `main.ts` --- projects/player/src/app/app.component.ts | 6 +++--- .../player-state/player-state.component.ts | 8 ++++---- .../components/unit-state/unit-state.component.ts | 8 ++++---- .../player/src/app/services/verona-post.service.ts | 4 ++-- .../app/services/verona-subscription.service.ts | 14 +++++++------- projects/player/src/main.ts | 3 +++ 6 files changed, 23 insertions(+), 20 deletions(-) diff --git a/projects/player/src/app/app.component.ts b/projects/player/src/app/app.component.ts index 99203d633..9f9a4f101 100644 --- a/projects/player/src/app/app.component.ts +++ b/projects/player/src/app/app.component.ts @@ -54,7 +54,7 @@ export class AppComponent implements OnInit { this.reset(); setTimeout(() => { // eslint-disable-next-line no-console - // console.log('player: onStart', message); + console.log('player: onStart', message); const unitDefinition: Unit = message.unitDefinition ? JSON.parse(message.unitDefinition) : {}; if (this.metaDataService.verifyUnitDefinitionVersion(unitDefinition.veronaModuleVersion)) { this.playerConfig = message.playerConfig || {}; @@ -78,13 +78,13 @@ export class AppComponent implements OnInit { private onFocus(focused: boolean): void { // eslint-disable-next-line no-console - // console.log('player: onFocus', focused); + console.log('player: onFocus', focused); this.veronaPostService.sendVopWindowFocusChangedNotification(focused); } private reset(): void { // eslint-disable-next-line no-console - // console.log('player: reset'); + console.log('player: reset'); this.pages = []; this.playerConfig = {}; this.unitStateElementCodes = []; diff --git a/projects/player/src/app/components/player-state/player-state.component.ts b/projects/player/src/app/components/player-state/player-state.component.ts index 2936c5ea9..3011f559e 100644 --- a/projects/player/src/app/components/player-state/player-state.component.ts +++ b/projects/player/src/app/components/player-state/player-state.component.ts @@ -68,21 +68,21 @@ export class PlayerStateComponent implements OnInit, OnDestroy { private onContinue(message: VopContinueCommand): void { // eslint-disable-next-line no-console - // console.log('player: onContinue', message); + console.log('player: onContinue', message); this.running = true; this.sendVopStateChangedNotification(); } private onStop(message: VopStopCommand): void { // eslint-disable-next-line no-console - // console.log('player: onStop', message); + console.log('player: onStop', message); this.running = false; this.sendVopStateChangedNotification(); } private onGetStateRequest(message: VopGetStateRequest): void { // eslint-disable-next-line no-console - // console.log('player: onGetStateRequest', message); + console.log('player: onGetStateRequest', message); if (message.stop) { this.running = false; } @@ -91,7 +91,7 @@ export class PlayerStateComponent implements OnInit, OnDestroy { private onPageNavigation(message: VopPageNavigationCommand): void { // eslint-disable-next-line no-console - // console.log('player: onPageNavigation', message); + console.log('player: onPageNavigation', message); this.selectIndex.next(parseInt(message.target, 10)); } diff --git a/projects/player/src/app/components/unit-state/unit-state.component.ts b/projects/player/src/app/components/unit-state/unit-state.component.ts index e67976f4f..934a482bf 100644 --- a/projects/player/src/app/components/unit-state/unit-state.component.ts +++ b/projects/player/src/app/components/unit-state/unit-state.component.ts @@ -108,7 +108,7 @@ export class UnitStateComponent implements OnInit, OnDestroy { private onNavigationDenied(message: VopNavigationDeniedNotification): void { // eslint-disable-next-line no-console - // console.log('player: onNavigationDenied', message); + console.log('player: onNavigationDenied', message); const reasons = message.reason?.map((reason: string) => this.translateService.instant(reason)); this.messageService.showWarning(reasons?.join(', ') || this.translateService.instant('noReason')); this.form.markAllAsTouched(); @@ -125,13 +125,13 @@ export class UnitStateComponent implements OnInit, OnDestroy { private onElementValueChanges = (value: ValueChangeElement): void => { // eslint-disable-next-line no-console - // console.log(`player: onElementValueChanges ${value.id}: old: ${value.values[0]}, new: ${value.values[1]}`); + console.log(`player: onElementValueChanges ${value.id}: old: ${value.values[0]}, new: ${value.values[1]}`); this.setUnitStateElementCodeValue(value.id, value.values[1]); }; private onFormChanges(): void { // eslint-disable-next-line no-console - // console.log('player: onFormChanges', this.unitStateElementCodes); + console.log('player: onFormChanges', this.unitStateElementCodes); this.sendVopStateChangedNotification(); } @@ -140,7 +140,7 @@ export class UnitStateComponent implements OnInit, OnDestroy { this.presentedPages.push(pagePresented); } // eslint-disable-next-line no-console - // console.log('player: onPresentedPageAdded', this.presentedPages); + console.log('player: onPresentedPageAdded', this.presentedPages); this.sendVopStateChangedNotification(); } diff --git a/projects/player/src/app/services/verona-post.service.ts b/projects/player/src/app/services/verona-post.service.ts index cd83ed737..651783d63 100644 --- a/projects/player/src/app/services/verona-post.service.ts +++ b/projects/player/src/app/services/verona-post.service.ts @@ -38,7 +38,7 @@ export class VeronaPostService { window.parent.postMessage(message, '*'); } else { // eslint-disable-next-line no-console - // console.warn('player: no host detected'); + console.warn('player: no host detected'); } } @@ -77,7 +77,7 @@ export class VeronaPostService { }); } else { // eslint-disable-next-line no-console - // console.warn('player: no playerMetadata defined'); + console.warn('player: no playerMetadata defined'); } } diff --git a/projects/player/src/app/services/verona-subscription.service.ts b/projects/player/src/app/services/verona-subscription.service.ts index b1faff4d6..ff0da4924 100644 --- a/projects/player/src/app/services/verona-subscription.service.ts +++ b/projects/player/src/app/services/verona-subscription.service.ts @@ -32,37 +32,37 @@ export class VeronaSubscriptionService { switch (messageData.type) { case 'vopStartCommand': // eslint-disable-next-line no-console - // console.log('player: _vopStartCommand ', messageData); + console.log('player: _vopStartCommand ', messageData); this._vopStartCommand.next(messageData); break; case 'vopNavigationDeniedNotification': // eslint-disable-next-line no-console - // console.log('player: _vopNavigationDeniedNotification ', messageData); + console.log('player: _vopNavigationDeniedNotification ', messageData); this._vopNavigationDeniedNotification.next(messageData); break; case 'vopPageNavigationCommand': // eslint-disable-next-line no-console - // console.log('player: _vopPageNavigationCommand ', messageData); + console.log('player: _vopPageNavigationCommand ', messageData); this._vopPageNavigationCommand.next(messageData); break; case 'vopStopCommand': // eslint-disable-next-line no-console - // console.log('player: _vopStopCommand ', messageData); + console.log('player: _vopStopCommand ', messageData); this._vopStopCommand.next(messageData); break; case 'vopContinueCommand': // eslint-disable-next-line no-console - // console.log('player: _vopContinueCommand ', messageData); + console.log('player: _vopContinueCommand ', messageData); this._vopContinueCommand.next(messageData); break; case 'vopGetStateRequest': // eslint-disable-next-line no-console - // console.log('player: _vopGetStateRequest ', messageData); + console.log('player: _vopGetStateRequest ', messageData); this._vopGetStateRequest.next(messageData); break; default: // eslint-disable-next-line no-console - // console.warn(`player: got message of unknown type ${messageData.type}`); + console.warn(`player: got message of unknown type ${messageData.type}`); } } diff --git a/projects/player/src/main.ts b/projects/player/src/main.ts index c7b673cf4..286e1b640 100644 --- a/projects/player/src/main.ts +++ b/projects/player/src/main.ts @@ -6,6 +6,9 @@ import { environment } from './environments/environment'; if (environment.production) { enableProdMode(); + if (window) { + window.console.log = () => {}; + } } platformBrowserDynamic().bootstrapModule(AppModule) -- GitLab