diff options
author | Chocobozzz <me@florianbigard.com> | 2022-07-15 15:30:14 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-07-18 11:37:18 +0200 |
commit | 42b40636991b97fe818007fab19091764fc5db73 (patch) | |
tree | db431787c06ce898d22e91ff771f795219274fc6 /client/src/standalone/videos/shared | |
parent | 654d4ede7fa4d0faa71e49bcfab6b65a686397b2 (diff) | |
download | PeerTube-42b40636991b97fe818007fab19091764fc5db73.tar.gz PeerTube-42b40636991b97fe818007fab19091764fc5db73.tar.zst PeerTube-42b40636991b97fe818007fab19091764fc5db73.zip |
Add ability for client to create server logs
Diffstat (limited to 'client/src/standalone/videos/shared')
5 files changed, 11 insertions, 6 deletions
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 @@ | |||
1 | import { peertubeTranslate } from '../../../../../shared/core-utils/i18n' | 1 | import { peertubeTranslate } from '../../../../../shared/core-utils/i18n' |
2 | import { VideoDetails } from '../../../../../shared/models' | 2 | import { VideoDetails } from '../../../../../shared/models' |
3 | import { logger } from '../../../root-helpers' | ||
3 | import { Translations } from './translations' | 4 | import { Translations } from './translations' |
4 | 5 | ||
5 | export class PlayerHTML { | 6 | export class PlayerHTML { |
@@ -29,7 +30,7 @@ export class PlayerHTML { | |||
29 | } | 30 | } |
30 | 31 | ||
31 | displayError (text: string, translations: Translations) { | 32 | displayError (text: string, translations: Translations) { |
32 | console.error(text) | 33 | logger.error(text) |
33 | 34 | ||
34 | // Remove video element | 35 | // Remove video element |
35 | if (this.playerElement) { | 36 | 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 { | |||
14 | getParamString, | 14 | getParamString, |
15 | getParamToggle, | 15 | getParamToggle, |
16 | isP2PEnabled, | 16 | isP2PEnabled, |
17 | logger, | ||
17 | peertubeLocalStorage, | 18 | peertubeLocalStorage, |
18 | UserLocalStorageKeys | 19 | UserLocalStorageKeys |
19 | } from '../../../root-helpers' | 20 | } from '../../../root-helpers' |
@@ -137,7 +138,7 @@ export class PlayerManagerOptions { | |||
137 | else this.mode = 'webtorrent' | 138 | else this.mode = 'webtorrent' |
138 | } | 139 | } |
139 | } catch (err) { | 140 | } catch (err) { |
140 | console.error('Cannot get params from URL.', err) | 141 | logger.error('Cannot get params from URL.', err) |
141 | } | 142 | } |
142 | } | 143 | } |
143 | 144 | ||
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 @@ | |||
1 | import { HttpStatusCode, ResultList, VideoPlaylistElement } from '../../../../../shared/models' | 1 | import { HttpStatusCode, ResultList, VideoPlaylistElement } from '../../../../../shared/models' |
2 | import { logger } from '../../../root-helpers' | ||
2 | import { AuthHTTP } from './auth-http' | 3 | import { AuthHTTP } from './auth-http' |
3 | 4 | ||
4 | export class PlaylistFetcher { | 5 | export class PlaylistFetcher { |
@@ -18,7 +19,7 @@ export class PlaylistFetcher { | |||
18 | playlistResponse = await playlistPromise | 19 | playlistResponse = await playlistPromise |
19 | isResponseOk = playlistResponse.status === HttpStatusCode.OK_200 | 20 | isResponseOk = playlistResponse.status === HttpStatusCode.OK_200 |
20 | } catch (err) { | 21 | } catch (err) { |
21 | console.error(err) | 22 | logger.error(err) |
22 | isResponseOk = false | 23 | isResponseOk = false |
23 | } | 24 | } |
24 | 25 | ||
@@ -49,7 +50,7 @@ export class PlaylistFetcher { | |||
49 | } | 50 | } |
50 | 51 | ||
51 | if (i === 10) { | 52 | if (i === 10) { |
52 | console.error('Cannot fetch all playlists elements, there are too many!') | 53 | logger.error('Cannot fetch all playlists elements, there are too many!') |
53 | } | 54 | } |
54 | 55 | ||
55 | return elements | 56 | 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 @@ | |||
1 | import { VideoPlaylist, VideoPlaylistElement } from '../../../../../shared/models' | 1 | import { VideoPlaylist, VideoPlaylistElement } from '../../../../../shared/models' |
2 | import { logger } from '../../../root-helpers' | ||
2 | 3 | ||
3 | export class PlaylistTracker { | 4 | export class PlaylistTracker { |
4 | private currentPlaylistElement: VideoPlaylistElement | 5 | private currentPlaylistElement: VideoPlaylistElement |
@@ -68,7 +69,7 @@ export class PlaylistTracker { | |||
68 | setPosition (position: number) { | 69 | setPosition (position: number) { |
69 | this.currentPlaylistElement = this.playlistElements.find(e => e.position === position) | 70 | this.currentPlaylistElement = this.playlistElements.find(e => e.position === position) |
70 | if (!this.currentPlaylistElement || !this.currentPlaylistElement.video) { | 71 | if (!this.currentPlaylistElement || !this.currentPlaylistElement.video) { |
71 | console.error('Current playlist element is not valid.', this.currentPlaylistElement) | 72 | logger.error('Current playlist element is not valid.', this.currentPlaylistElement) |
72 | this.currentPlaylistElement = this.getNextPlaylistElement() | 73 | this.currentPlaylistElement = this.getNextPlaylistElement() |
73 | } | 74 | } |
74 | 75 | ||
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 @@ | |||
1 | import { HttpStatusCode, LiveVideo, VideoDetails } from '../../../../../shared/models' | 1 | import { HttpStatusCode, LiveVideo, VideoDetails } from '../../../../../shared/models' |
2 | import { logger } from '../../../root-helpers' | ||
2 | import { AuthHTTP } from './auth-http' | 3 | import { AuthHTTP } from './auth-http' |
3 | 4 | ||
4 | export class VideoFetcher { | 5 | export class VideoFetcher { |
@@ -17,7 +18,7 @@ export class VideoFetcher { | |||
17 | videoResponse = await videoPromise | 18 | videoResponse = await videoPromise |
18 | isResponseOk = videoResponse.status === HttpStatusCode.OK_200 | 19 | isResponseOk = videoResponse.status === HttpStatusCode.OK_200 |
19 | } catch (err) { | 20 | } catch (err) { |
20 | console.error(err) | 21 | logger.error(err) |
21 | 22 | ||
22 | isResponseOk = false | 23 | isResponseOk = false |
23 | } | 24 | } |