Commit f1470c89 authored by jojohoch's avatar jojohoch
Browse files

[player] Replace 'console.log' with 'LogService.info'

parent 1907f78b
......@@ -9,6 +9,7 @@ import {
VopMetaData,
VopStateChangedNotification
} from '../models/verona';
import { LogService } from 'logging/services/log.service';
@Injectable({
providedIn: 'root'
......@@ -40,8 +41,7 @@ export class VeronaPostService {
if (!this._isStandalone) {
window.parent.postMessage(message, '*');
} else {
// eslint-disable-next-line no-console
console.warn('player: no host detected');
LogService.warn('player: no host detected');
}
}
......@@ -74,15 +74,13 @@ export class VeronaPostService {
sendVopReadyNotification(playerMetadata: VopMetaData): void {
if (playerMetadata) {
// eslint-disable-next-line no-console
console.log('player: sendVopReadyNotification', playerMetadata);
LogService.info('player: sendVopReadyNotification', playerMetadata);
this.send({
type: 'vopReadyNotification',
...playerMetadata
});
} else {
// eslint-disable-next-line no-console
console.warn('player: no playerMetadata defined');
LogService.warn('player: no playerMetadata defined');
}
}
......
......@@ -7,6 +7,7 @@ import {
VopPageNavigationCommand,
VopStartCommand, VopStopCommand
} from '../models/verona';
import { LogService } from 'logging/services/log.service';
@Injectable({
providedIn: 'root'
......@@ -28,38 +29,31 @@ export class VeronaSubscriptionService {
private handleMessage(messageData: VopMessage): void {
switch (messageData.type) {
case 'vopStartCommand':
// eslint-disable-next-line no-console
console.log('player: _vopStartCommand ', messageData);
LogService.info('player: _vopStartCommand ', messageData);
this._vopStartCommand.next(messageData);
break;
case 'vopNavigationDeniedNotification':
// eslint-disable-next-line no-console
console.log('player: _vopNavigationDeniedNotification ', messageData);
LogService.info('player: _vopNavigationDeniedNotification ', messageData);
this._vopNavigationDeniedNotification.next(messageData);
break;
case 'vopPageNavigationCommand':
// eslint-disable-next-line no-console
console.log('player: _vopPageNavigationCommand ', messageData);
LogService.info('player: _vopPageNavigationCommand ', messageData);
this._vopPageNavigationCommand.next(messageData);
break;
case 'vopStopCommand':
// eslint-disable-next-line no-console
console.log('player: _vopStopCommand ', messageData);
LogService.info('player: _vopStopCommand ', messageData);
this._vopStopCommand.next(messageData);
break;
case 'vopContinueCommand':
// eslint-disable-next-line no-console
console.log('player: _vopContinueCommand ', messageData);
LogService.info('player: _vopContinueCommand ', messageData);
this._vopContinueCommand.next(messageData);
break;
case 'vopGetStateRequest':
// eslint-disable-next-line no-console
console.log('player: _vopGetStateRequest ', messageData);
LogService.info('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}`);
LogService.warn(`player: got message of unknown type ${messageData.type}`);
}
}
......
......@@ -16,6 +16,7 @@ import { UnitFactory } from 'common/util/unit.factory';
import { SanitizationService } from 'common/services/sanitization.service';
import { UnitUtils } from 'common/util/unit-utils';
import { DragNDropValueObject, UIElement } from 'common/interfaces/elements';
import { LogService } from 'logging/services/log.service';
@Component({
selector: 'aspect-player',
......@@ -67,16 +68,14 @@ export class AppComponent implements OnInit {
private onStart(message: VopStartCommand): void {
this.reset();
setTimeout(() => {
// eslint-disable-next-line no-console
console.log('player: onStart', message);
LogService.info('player: onStart', message);
if (message.unitDefinition) {
const unitDefinition: Unit = UnitFactory.createUnit(
this.sanitizationService.sanitizeUnitDefinition(JSON.parse(message.unitDefinition))
);
this.configureSession(message, unitDefinition);
} else {
// eslint-disable-next-line no-console
console.warn('player: message has no unitDefinition');
LogService.warn('player: message has no unitDefinition');
}
});
}
......@@ -85,8 +84,7 @@ export class AppComponent implements OnInit {
this.pages = unitDefinition.pages;
this.playerConfig = message.playerConfig || {};
this.configureServices(message);
// eslint-disable-next-line no-console
console.log('player: unitStateElementCodes', this.unitStateService.elementCodes);
LogService.info('player: unitStateElementCodes', this.unitStateService.elementCodes);
}
private configureServices(message: VopStartCommand): void {
......@@ -111,14 +109,12 @@ export class AppComponent implements OnInit {
}
private onFocus(focused: boolean): void {
// eslint-disable-next-line no-console
console.log('player: onFocus', focused);
LogService.info('player: onFocus', focused);
this.veronaPostService.sendVopWindowFocusChangedNotification(focused);
}
private reset(): void {
// eslint-disable-next-line no-console
console.log('player: reset');
LogService.info('player: reset');
this.pages = [];
this.playerConfig = null;
this.unitStateService.reset();
......
......@@ -85,8 +85,7 @@ import { PageIndexPipe } from './pipes/page-index.pipe';
}),
OverlayModule,
UnitDefinitionMenuModule
],
providers: []
]
})
export class AppModule implements DoBootstrap {
......
......@@ -11,6 +11,7 @@ import {
import { VeronaPostService } from 'verona/services/verona-post.service';
import { Page } from 'common/interfaces/unit';
import { NavigationService } from '../../services/navigation.service';
import { LogService } from 'logging/services/log.service';
@Component({
selector: 'aspect-player-state',
......@@ -67,22 +68,19 @@ export class PlayerStateComponent implements OnInit, OnDestroy {
private onContinue(message: VopContinueCommand): void {
// eslint-disable-next-line no-console
console.log('player: onContinue', message);
LogService.info('player: onContinue', message);
this.running = true;
this.sendVopStateChangedNotification();
}
private onStop(message: VopStopCommand): void {
// eslint-disable-next-line no-console
console.log('player: onStop', message);
LogService.info('player: onStop', message);
this.running = false;
this.sendVopStateChangedNotification();
}
private onGetStateRequest(message: VopGetStateRequest): void {
// eslint-disable-next-line no-console
console.log('player: onGetStateRequest', message);
LogService.info('player: onGetStateRequest', message);
if (message.stop) {
this.running = false;
}
......@@ -95,8 +93,7 @@ export class PlayerStateComponent implements OnInit, OnDestroy {
currentPage: this.currentPlayerPageIndex.toString(10),
validPages: this.validPages
};
// eslint-disable-next-line no-console
console.log('player: playerState sendVopStateChangedNotification', playerState);
LogService.info('player: playerState sendVopStateChangedNotification', playerState);
this.veronaPostService.sendVopStateChangedNotification({ playerState }, requested);
}
......
......@@ -13,6 +13,7 @@ import { VopNavigationDeniedNotification } from 'verona/models/verona';
import { MessageService } from 'common/services/message.service';
import { VeronaSubscriptionService } from 'verona/services/verona-subscription.service';
import { ValidationService } from '../services/validation.service';
import { LogService } from 'logging/services/log.service';
@Directive()
export abstract class ElementFormGroupDirective extends ElementGroupDirective implements OnDestroy {
......@@ -50,8 +51,7 @@ export abstract class ElementFormGroupDirective extends ElementGroupDirective im
}
private onNavigationDenied(message: VopNavigationDeniedNotification): void {
// eslint-disable-next-line no-console
console.log('player: onNavigationDenied', message);
LogService.info('player: onNavigationDenied', message);
const reasons = message.reason?.map((reason: string) => this.translateService.instant(reason));
this.messageService.showWarning(reasons?.join(', ') || this.translateService.instant('noReason'));
if (message.reason && message.reason.find(reason => reason === 'responsesIncomplete')) {
......
......@@ -7,6 +7,7 @@ import { MediaPlayerService } from '../services/media-player.service';
import { VeronaSubscriptionService } from 'verona/services/verona-subscription.service';
import { VeronaPostService } from 'verona/services/verona-post.service';
import { ValidationService } from '../services/validation.service';
import { LogService } from 'logging/services/log.service';
@Directive({
selector: '[aspectUnitState]'
......@@ -40,8 +41,7 @@ export class UnitStateDirective implements OnInit, OnDestroy {
}
private sendVopStateChangedNotification(): void {
// eslint-disable-next-line no-console
console.log('player: this.unitStateService.unitStateElementCodes',
LogService.info('player: this.unitStateService.unitStateElementCodes',
this.unitStateService.elementCodes);
const unitState: UnitState = {
dataParts: {
......@@ -51,8 +51,7 @@ export class UnitStateDirective implements OnInit, OnDestroy {
responseProgress: this.validatorService.responseProgress,
unitStateDataType: 'iqb-standard@1.0'
};
// eslint-disable-next-line no-console
console.log('player: unitState sendVopStateChangedNotification', unitState);
LogService.info('player: unitState sendVopStateChangedNotification', unitState);
this.veronaPostService.sendVopStateChangedNotification({ unitState });
}
......
import { TextComponent } from 'common/components/ui-elements/text.component';
import { Injectable } from '@angular/core';
import { LogService } from 'logging/services/log.service';
@Injectable({
......@@ -26,8 +27,7 @@ export class TextMarkingService {
});
textComponent.savedText = element.innerHTML;
} else {
// eslint-disable-next-line no-console
console.warn('Selection contains elements that are outside the text component!');
LogService.warn('Selection contains elements that are outside the text component!');
}
selection.removeAllRanges();
} // nothing to do!
......@@ -197,8 +197,7 @@ export class TextMarkingService {
if (nodeValues.text) {
TextMarkingService.clearMarking(node, nodeValues.text, nodeValues.previousText, nodeValues.nextText);
} else {
// eslint-disable-next-line no-console
console.warn('Cannot recreate node for text', nodeValues);
LogService.warn('Cannot recreate node for text', nodeValues);
}
}
});
......
......@@ -10,6 +10,7 @@ import {
} from 'verona/models/verona';
import { IntersectionDetector } from '../classes/intersection-detector';
import { InputElementValue, ValueChangeElement } from 'common/interfaces/elements';
import { LogService } from 'logging/services/log.service';
@Injectable({
providedIn: 'root'
......@@ -73,15 +74,13 @@ export class UnitStateService {
}
changeElementCodeValue(elementValue: ValueChangeElement): void {
// eslint-disable-next-line no-console
console.log(`player: changeElementValue ${elementValue.id}: ${elementValue.value}`);
LogService.info(`player: changeElementValue ${elementValue.id}: ${elementValue.value}`);
this.setElementCodeValue(elementValue.id, elementValue.value);
this.setElementCodeStatus(elementValue.id, 'VALUE_CHANGED');
}
changeElementCodeStatus(elementStatus: StatusChangeElement): void {
// eslint-disable-next-line no-console
console.log(`player: changeElementStatus ${elementStatus.id}: ${elementStatus.status}`);
LogService.info(`player: changeElementStatus ${elementStatus.id}: ${elementStatus.status}`);
this.setElementCodeStatus(elementStatus.id, elementStatus.status);
}
......@@ -132,8 +131,7 @@ export class UnitStateService {
this._presentedPageAdded.next(pageIndex);
}
} else {
// eslint-disable-next-line no-console
console.log(`player: page ${pageIndex} is already presented`);
LogService.info(`player: page ${pageIndex} is already presented`);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment