openvidu-angular: Removed custom service for webcomponent logging

pull/743/head
csantosm 2022-07-14 09:46:30 +02:00
parent 1d70791fd9
commit 353dd2b545
1 changed files with 7 additions and 9 deletions

View File

@ -1,5 +1,5 @@
import { Component, ElementRef, Input, OnInit, Output, EventEmitter } from '@angular/core'; import { Component, ElementRef, Input, OnInit, Output, EventEmitter } from '@angular/core';
import { ILogger, LoggerService, OpenViduService, TokenModel, ParticipantAbstractModel, RecordingInfo } from 'openvidu-angular'; import { OpenViduService, TokenModel, ParticipantAbstractModel, RecordingInfo } from 'openvidu-angular';
import { Session } from 'openvidu-browser'; import { Session } from 'openvidu-browser';
/** /**
@ -531,13 +531,11 @@ export class OpenviduWebComponentComponent implements OnInit {
* @internal * @internal
*/ */
success: boolean = false; success: boolean = false;
private log: ILogger;
/** /**
* @internal * @internal
*/ */
constructor(private loggerService: LoggerService, private host: ElementRef, private openviduService: OpenViduService) { constructor(private host: ElementRef, private openviduService: OpenViduService) {
this.log = this.loggerService.get('WebComponent');
this.host.nativeElement.disconnect = this.disconnect.bind(this); this.host.nativeElement.disconnect = this.disconnect.bind(this);
} }
@ -553,19 +551,19 @@ export class OpenviduWebComponentComponent implements OnInit {
*/ */
@Input('tokens') @Input('tokens')
set tokens(value: TokenModel | string) { set tokens(value: TokenModel | string) {
this.log.d('Webcomponent tokens: ', value); console.debug('Webcomponent tokens: ', value);
try { try {
this._tokens = this.castToJson(value); this._tokens = this.castToJson(value);
this.success = !!this._tokens?.webcam && !!this._tokens?.screen; this.success = !!this._tokens?.webcam && !!this._tokens?.screen;
} catch (error) { } catch (error) {
if (typeof value === 'string' && value !== '') { if (typeof value === 'string' && value !== '') {
this.log.d('Sigle token received.'); console.debug('Sigle token received.');
this._tokens = { webcam: value }; this._tokens = { webcam: value };
this.success = true; this.success = true;
} else { } else {
this.log.e(error); console.error(error);
this.log.e('Parameters received are incorrect: ', value); console.error('Parameters received are incorrect: ', value);
this.log.e('Session cannot start'); console.error('Session cannot start');
} }
} }
} }