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 --- client/src/standalone/videos/shared/player-html.ts | 3 ++- client/src/standalone/videos/shared/player-manager-options.ts | 3 ++- client/src/standalone/videos/shared/playlist-fetcher.ts | 5 +++-- client/src/standalone/videos/shared/playlist-tracker.ts | 3 ++- client/src/standalone/videos/shared/video-fetcher.ts | 3 ++- 5 files changed, 11 insertions(+), 6 deletions(-) (limited to 'client/src/standalone/videos/shared') diff --git a/client/src/standalone/videos/shared/player-html.ts b/client/src/standalone/videos/shared/player-html.ts index eb6324ac7..61231d2cb 100644 --- a/client/src/standalone/videos/shared/player-html.ts +++ b/client/src/standalone/videos/shared/player-html.ts @@ -1,5 +1,6 @@ import { peertubeTranslate } from '../../../../../shared/core-utils/i18n' import { VideoDetails } from '../../../../../shared/models' +import { logger } from '../../../root-helpers' import { Translations } from './translations' export class PlayerHTML { @@ -29,7 +30,7 @@ export class PlayerHTML { } displayError (text: string, translations: Translations) { - console.error(text) + logger.error(text) // Remove video element if (this.playerElement) { diff --git a/client/src/standalone/videos/shared/player-manager-options.ts b/client/src/standalone/videos/shared/player-manager-options.ts index f3bd46a69..2eeb5ecac 100644 --- a/client/src/standalone/videos/shared/player-manager-options.ts +++ b/client/src/standalone/videos/shared/player-manager-options.ts @@ -14,6 +14,7 @@ import { getParamString, getParamToggle, isP2PEnabled, + logger, peertubeLocalStorage, UserLocalStorageKeys } from '../../../root-helpers' @@ -137,7 +138,7 @@ export class PlayerManagerOptions { else this.mode = 'webtorrent' } } catch (err) { - console.error('Cannot get params from URL.', err) + logger.error('Cannot get params from URL.', err) } } diff --git a/client/src/standalone/videos/shared/playlist-fetcher.ts b/client/src/standalone/videos/shared/playlist-fetcher.ts index a7e72c177..713d82e3a 100644 --- a/client/src/standalone/videos/shared/playlist-fetcher.ts +++ b/client/src/standalone/videos/shared/playlist-fetcher.ts @@ -1,4 +1,5 @@ import { HttpStatusCode, ResultList, VideoPlaylistElement } from '../../../../../shared/models' +import { logger } from '../../../root-helpers' import { AuthHTTP } from './auth-http' export class PlaylistFetcher { @@ -18,7 +19,7 @@ export class PlaylistFetcher { playlistResponse = await playlistPromise isResponseOk = playlistResponse.status === HttpStatusCode.OK_200 } catch (err) { - console.error(err) + logger.error(err) isResponseOk = false } @@ -49,7 +50,7 @@ export class PlaylistFetcher { } if (i === 10) { - console.error('Cannot fetch all playlists elements, there are too many!') + logger.error('Cannot fetch all playlists elements, there are too many!') } return elements diff --git a/client/src/standalone/videos/shared/playlist-tracker.ts b/client/src/standalone/videos/shared/playlist-tracker.ts index 75d10b4e2..9ea4be83f 100644 --- a/client/src/standalone/videos/shared/playlist-tracker.ts +++ b/client/src/standalone/videos/shared/playlist-tracker.ts @@ -1,4 +1,5 @@ import { VideoPlaylist, VideoPlaylistElement } from '../../../../../shared/models' +import { logger } from '../../../root-helpers' export class PlaylistTracker { private currentPlaylistElement: VideoPlaylistElement @@ -68,7 +69,7 @@ export class PlaylistTracker { setPosition (position: number) { this.currentPlaylistElement = this.playlistElements.find(e => e.position === position) if (!this.currentPlaylistElement || !this.currentPlaylistElement.video) { - console.error('Current playlist element is not valid.', this.currentPlaylistElement) + logger.error('Current playlist element is not valid.', this.currentPlaylistElement) this.currentPlaylistElement = this.getNextPlaylistElement() } diff --git a/client/src/standalone/videos/shared/video-fetcher.ts b/client/src/standalone/videos/shared/video-fetcher.ts index e78d38536..b42d622f9 100644 --- a/client/src/standalone/videos/shared/video-fetcher.ts +++ b/client/src/standalone/videos/shared/video-fetcher.ts @@ -1,4 +1,5 @@ import { HttpStatusCode, LiveVideo, VideoDetails } from '../../../../../shared/models' +import { logger } from '../../../root-helpers' import { AuthHTTP } from './auth-http' export class VideoFetcher { @@ -17,7 +18,7 @@ export class VideoFetcher { videoResponse = await videoPromise isResponseOk = videoResponse.status === HttpStatusCode.OK_200 } catch (err) { - console.error(err) + logger.error(err) isResponseOk = false } -- cgit v1.2.3