From 42b40636991b97fe818007fab19091764fc5db73 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 15 Jul 2022 15:30:14 +0200 Subject: Add ability for client to create server logs --- .../shared/metadata/video-description.component.ts | 3 ++- .../src/app/+videos/+video-watch/video-watch.component.ts | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'client/src/app/+videos/+video-watch') diff --git a/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts b/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts index e002b3c22..b5444facb 100644 --- a/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts +++ b/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts @@ -1,6 +1,7 @@ import { Component, EventEmitter, Input, OnChanges, Output } from '@angular/core' import { MarkdownService, Notifier } from '@app/core' import { VideoDetails, VideoService } from '@app/shared/shared-main' +import { logger } from '@root-helpers/logger' @Component({ selector: 'my-video-description', @@ -75,7 +76,7 @@ export class VideoDescriptionComponent implements OnChanges { private updateVideoDescription (description: string) { this.video.description = description this.setVideoDescriptionHTML() - .catch(err => console.error(err)) + .catch(err => logger.error(err)) } private async setVideoDescriptionHTML () { diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts index 6a3bd1522..292ce6441 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts @@ -24,6 +24,7 @@ import { Video, VideoCaptionService, VideoDetails, VideoService } from '@app/sha import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription' import { LiveVideoService } from '@app/shared/shared-video-live' import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' +import { logger } from '@root-helpers/logger' import { isP2PEnabled } from '@root-helpers/video' import { timeToInt } from '@shared/core-utils' import { @@ -225,7 +226,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { : parseInt(positionParam + '', 10) if (isNaN(this.playlistPosition)) { - console.error(`playlistPosition query param '${positionParam}' was parsed as NaN, defaulting to 1.`) + logger.error(`playlistPosition query param '${positionParam}' was parsed as NaN, defaulting to 1.`) this.playlistPosition = 1 } @@ -378,7 +379,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { } this.buildPlayer(urlOptions, loggedInOrAnonymousUser) - .catch(err => console.error('Cannot build the player', err)) + .catch(err => logger.error('Cannot build the player', err)) this.setOpenGraphTags() @@ -550,7 +551,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { this.player.dispose() this.player = undefined } catch (err) { - console.error('Cannot dispose player.', err) + logger.error('Cannot dispose player.', err) } } @@ -717,7 +718,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { private handleLiveStateChange (newState: VideoState) { if (newState !== VideoState.PUBLISHED) return - console.log('Loading video after live update.') + logger.info('Loading video after live update.') const videoUUID = this.video.uuid @@ -728,11 +729,11 @@ export class VideoWatchComponent implements OnInit, OnDestroy { private handleLiveViewsChange (newViewers: number) { if (!this.video) { - console.error('Cannot update video live views because video is no defined.') + logger.error('Cannot update video live views because video is no defined.') return } - console.log('Updating live views.') + logger.info('Updating live views.') this.video.viewers = newViewers } -- cgit v1.2.3