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/app/+videos | |
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/app/+videos')
8 files changed, 23 insertions, 15 deletions
diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts index c74ef5731..99f8c9034 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts +++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts | |||
@@ -38,6 +38,7 @@ import { VideoCaptionAddModalComponent } from './video-caption-add-modal.compone | |||
38 | import { VideoCaptionEditModalComponent } from './video-caption-edit-modal/video-caption-edit-modal.component' | 38 | import { VideoCaptionEditModalComponent } from './video-caption-edit-modal/video-caption-edit-modal.component' |
39 | import { VideoEditType } from './video-edit.type' | 39 | import { VideoEditType } from './video-edit.type' |
40 | import { VideoSource } from '@shared/models/videos/video-source' | 40 | import { VideoSource } from '@shared/models/videos/video-source' |
41 | import { logger } from '@root-helpers/logger' | ||
41 | 42 | ||
42 | type VideoLanguages = VideoConstant<string> & { group?: string } | 43 | type VideoLanguages = VideoConstant<string> & { group?: string } |
43 | type PluginField = { | 44 | type PluginField = { |
@@ -443,7 +444,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
443 | 444 | ||
444 | const oldChannel = this.userVideoChannels.find(c => c.id === oldChannelId) | 445 | const oldChannel = this.userVideoChannels.find(c => c.id === oldChannelId) |
445 | if (!newChannel || !oldChannel) { | 446 | if (!newChannel || !oldChannel) { |
446 | console.error('Cannot find new or old channel.') | 447 | logger.error('Cannot find new or old channel.') |
447 | return | 448 | return |
448 | } | 449 | } |
449 | 450 | ||
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts index 80e5a73da..91eb66931 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts | |||
@@ -7,6 +7,7 @@ import { FormValidatorService } from '@app/shared/shared-forms' | |||
7 | import { Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' | 7 | import { Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' |
8 | import { LiveVideoService } from '@app/shared/shared-video-live' | 8 | import { LiveVideoService } from '@app/shared/shared-video-live' |
9 | import { LoadingBarService } from '@ngx-loading-bar/core' | 9 | import { LoadingBarService } from '@ngx-loading-bar/core' |
10 | import { logger } from '@root-helpers/logger' | ||
10 | import { LiveVideo, LiveVideoCreate, LiveVideoLatencyMode, LiveVideoUpdate, PeerTubeProblemDocument, ServerErrorCode } from '@shared/models' | 11 | import { LiveVideo, LiveVideoCreate, LiveVideoLatencyMode, LiveVideoUpdate, PeerTubeProblemDocument, ServerErrorCode } from '@shared/models' |
11 | import { VideoSend } from './video-send' | 12 | import { VideoSend } from './video-send' |
12 | 13 | ||
@@ -141,7 +142,7 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView | |||
141 | error: err => { | 142 | error: err => { |
142 | this.error = err.message | 143 | this.error = err.message |
143 | scrollToTop() | 144 | scrollToTop() |
144 | console.error(err) | 145 | logger.error(err) |
145 | } | 146 | } |
146 | }) | 147 | }) |
147 | } | 148 | } |
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts index da4996902..7b9531d27 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts | |||
@@ -6,6 +6,7 @@ import { scrollToTop } from '@app/helpers' | |||
6 | import { FormValidatorService } from '@app/shared/shared-forms' | 6 | import { FormValidatorService } from '@app/shared/shared-forms' |
7 | import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main' | 7 | import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main' |
8 | import { LoadingBarService } from '@ngx-loading-bar/core' | 8 | import { LoadingBarService } from '@ngx-loading-bar/core' |
9 | import { logger } from '@root-helpers/logger' | ||
9 | import { PeerTubeProblemDocument, ServerErrorCode, VideoUpdate } from '@shared/models' | 10 | import { PeerTubeProblemDocument, ServerErrorCode, VideoUpdate } from '@shared/models' |
10 | import { hydrateFormFromVideo } from '../shared/video-edit-utils' | 11 | import { hydrateFormFromVideo } from '../shared/video-edit-utils' |
11 | import { VideoSend } from './video-send' | 12 | import { VideoSend } from './video-send' |
@@ -139,7 +140,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Af | |||
139 | error: err => { | 140 | error: err => { |
140 | this.error = err.message | 141 | this.error = err.message |
141 | scrollToTop() | 142 | scrollToTop() |
142 | console.error(err) | 143 | logger.error(err) |
143 | } | 144 | } |
144 | }) | 145 | }) |
145 | } | 146 | } |
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts index 971a2a070..4ef7d1321 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts | |||
@@ -7,6 +7,7 @@ import { scrollToTop } from '@app/helpers' | |||
7 | import { FormValidatorService } from '@app/shared/shared-forms' | 7 | import { FormValidatorService } from '@app/shared/shared-forms' |
8 | import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main' | 8 | import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main' |
9 | import { LoadingBarService } from '@ngx-loading-bar/core' | 9 | import { LoadingBarService } from '@ngx-loading-bar/core' |
10 | import { logger } from '@root-helpers/logger' | ||
10 | import { VideoUpdate } from '@shared/models' | 11 | import { VideoUpdate } from '@shared/models' |
11 | import { hydrateFormFromVideo } from '../shared/video-edit-utils' | 12 | import { hydrateFormFromVideo } from '../shared/video-edit-utils' |
12 | import { VideoSend } from './video-send' | 13 | import { VideoSend } from './video-send' |
@@ -128,7 +129,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, AfterV | |||
128 | error: err => { | 129 | error: err => { |
129 | this.error = err.message | 130 | this.error = err.message |
130 | scrollToTop() | 131 | scrollToTop() |
131 | console.error(err) | 132 | logger.error(err) |
132 | } | 133 | } |
133 | }) | 134 | }) |
134 | } | 135 | } |
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts index 663955d27..66a3967c7 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | import { truncate } from 'lodash-es' | 1 | import { truncate } from 'lodash-es' |
2 | import { UploadState, UploadxOptions, UploadxService } from 'ngx-uploadx' | 2 | import { UploadState, UploadxOptions, UploadxService } from 'ngx-uploadx' |
3 | import { isIOS } from '@root-helpers/web-browser' | ||
4 | import { HttpErrorResponse, HttpEventType, HttpHeaders } from '@angular/common/http' | 3 | import { HttpErrorResponse, HttpEventType, HttpHeaders } from '@angular/common/http' |
5 | import { AfterViewInit, Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' | 4 | import { AfterViewInit, Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' |
6 | import { ActivatedRoute, Router } from '@angular/router' | 5 | import { ActivatedRoute, Router } from '@angular/router' |
@@ -9,6 +8,8 @@ import { genericUploadErrorHandler, scrollToTop } from '@app/helpers' | |||
9 | import { FormValidatorService } from '@app/shared/shared-forms' | 8 | import { FormValidatorService } from '@app/shared/shared-forms' |
10 | import { BytesPipe, Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' | 9 | import { BytesPipe, Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' |
11 | import { LoadingBarService } from '@ngx-loading-bar/core' | 10 | import { LoadingBarService } from '@ngx-loading-bar/core' |
11 | import { logger } from '@root-helpers/logger' | ||
12 | import { isIOS } from '@root-helpers/web-browser' | ||
12 | import { HttpStatusCode, VideoCreateResult } from '@shared/models' | 13 | import { HttpStatusCode, VideoCreateResult } from '@shared/models' |
13 | import { UploaderXFormData } from './uploaderx-form-data' | 14 | import { UploaderXFormData } from './uploaderx-form-data' |
14 | import { VideoSend } from './video-send' | 15 | import { VideoSend } from './video-send' |
@@ -264,7 +265,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
264 | error: err => { | 265 | error: err => { |
265 | this.error = err.message | 266 | this.error = err.message |
266 | scrollToTop() | 267 | scrollToTop() |
267 | console.error(err) | 268 | logger.error(err) |
268 | } | 269 | } |
269 | }) | 270 | }) |
270 | } | 271 | } |
diff --git a/client/src/app/+videos/+video-edit/video-update.component.ts b/client/src/app/+videos/+video-edit/video-update.component.ts index 13e786a8e..ed17dff06 100644 --- a/client/src/app/+videos/+video-edit/video-update.component.ts +++ b/client/src/app/+videos/+video-edit/video-update.component.ts | |||
@@ -8,9 +8,10 @@ import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | |||
8 | import { Video, VideoCaptionEdit, VideoCaptionService, VideoDetails, VideoEdit, VideoService } from '@app/shared/shared-main' | 8 | import { Video, VideoCaptionEdit, VideoCaptionService, VideoDetails, VideoEdit, VideoService } from '@app/shared/shared-main' |
9 | import { LiveVideoService } from '@app/shared/shared-video-live' | 9 | import { LiveVideoService } from '@app/shared/shared-video-live' |
10 | import { LoadingBarService } from '@ngx-loading-bar/core' | 10 | import { LoadingBarService } from '@ngx-loading-bar/core' |
11 | import { logger } from '@root-helpers/logger' | ||
11 | import { LiveVideo, LiveVideoUpdate, VideoPrivacy } from '@shared/models' | 12 | import { LiveVideo, LiveVideoUpdate, VideoPrivacy } from '@shared/models' |
12 | import { hydrateFormFromVideo } from './shared/video-edit-utils' | ||
13 | import { VideoSource } from '@shared/models/videos/video-source' | 13 | import { VideoSource } from '@shared/models/videos/video-source' |
14 | import { hydrateFormFromVideo } from './shared/video-edit-utils' | ||
14 | 15 | ||
15 | @Component({ | 16 | @Component({ |
16 | selector: 'my-videos-update', | 17 | selector: 'my-videos-update', |
@@ -156,7 +157,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
156 | this.loadingBar.useRef().complete() | 157 | this.loadingBar.useRef().complete() |
157 | this.isUpdatingVideo = false | 158 | this.isUpdatingVideo = false |
158 | this.notifier.error(err.message) | 159 | this.notifier.error(err.message) |
159 | console.error(err) | 160 | logger.error(err) |
160 | } | 161 | } |
161 | }) | 162 | }) |
162 | } | 163 | } |
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 @@ | |||
1 | import { Component, EventEmitter, Input, OnChanges, Output } from '@angular/core' | 1 | import { Component, EventEmitter, Input, OnChanges, Output } from '@angular/core' |
2 | import { MarkdownService, Notifier } from '@app/core' | 2 | import { MarkdownService, Notifier } from '@app/core' |
3 | import { VideoDetails, VideoService } from '@app/shared/shared-main' | 3 | import { VideoDetails, VideoService } from '@app/shared/shared-main' |
4 | import { logger } from '@root-helpers/logger' | ||
4 | 5 | ||
5 | @Component({ | 6 | @Component({ |
6 | selector: 'my-video-description', | 7 | selector: 'my-video-description', |
@@ -75,7 +76,7 @@ export class VideoDescriptionComponent implements OnChanges { | |||
75 | private updateVideoDescription (description: string) { | 76 | private updateVideoDescription (description: string) { |
76 | this.video.description = description | 77 | this.video.description = description |
77 | this.setVideoDescriptionHTML() | 78 | this.setVideoDescriptionHTML() |
78 | .catch(err => console.error(err)) | 79 | .catch(err => logger.error(err)) |
79 | } | 80 | } |
80 | 81 | ||
81 | private async setVideoDescriptionHTML () { | 82 | 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 | |||
24 | import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription' | 24 | import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription' |
25 | import { LiveVideoService } from '@app/shared/shared-video-live' | 25 | import { LiveVideoService } from '@app/shared/shared-video-live' |
26 | import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' | 26 | import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' |
27 | import { logger } from '@root-helpers/logger' | ||
27 | import { isP2PEnabled } from '@root-helpers/video' | 28 | import { isP2PEnabled } from '@root-helpers/video' |
28 | import { timeToInt } from '@shared/core-utils' | 29 | import { timeToInt } from '@shared/core-utils' |
29 | import { | 30 | import { |
@@ -225,7 +226,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
225 | : parseInt(positionParam + '', 10) | 226 | : parseInt(positionParam + '', 10) |
226 | 227 | ||
227 | if (isNaN(this.playlistPosition)) { | 228 | if (isNaN(this.playlistPosition)) { |
228 | console.error(`playlistPosition query param '${positionParam}' was parsed as NaN, defaulting to 1.`) | 229 | logger.error(`playlistPosition query param '${positionParam}' was parsed as NaN, defaulting to 1.`) |
229 | this.playlistPosition = 1 | 230 | this.playlistPosition = 1 |
230 | } | 231 | } |
231 | 232 | ||
@@ -378,7 +379,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
378 | } | 379 | } |
379 | 380 | ||
380 | this.buildPlayer(urlOptions, loggedInOrAnonymousUser) | 381 | this.buildPlayer(urlOptions, loggedInOrAnonymousUser) |
381 | .catch(err => console.error('Cannot build the player', err)) | 382 | .catch(err => logger.error('Cannot build the player', err)) |
382 | 383 | ||
383 | this.setOpenGraphTags() | 384 | this.setOpenGraphTags() |
384 | 385 | ||
@@ -550,7 +551,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
550 | this.player.dispose() | 551 | this.player.dispose() |
551 | this.player = undefined | 552 | this.player = undefined |
552 | } catch (err) { | 553 | } catch (err) { |
553 | console.error('Cannot dispose player.', err) | 554 | logger.error('Cannot dispose player.', err) |
554 | } | 555 | } |
555 | } | 556 | } |
556 | 557 | ||
@@ -717,7 +718,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
717 | private handleLiveStateChange (newState: VideoState) { | 718 | private handleLiveStateChange (newState: VideoState) { |
718 | if (newState !== VideoState.PUBLISHED) return | 719 | if (newState !== VideoState.PUBLISHED) return |
719 | 720 | ||
720 | console.log('Loading video after live update.') | 721 | logger.info('Loading video after live update.') |
721 | 722 | ||
722 | const videoUUID = this.video.uuid | 723 | const videoUUID = this.video.uuid |
723 | 724 | ||
@@ -728,11 +729,11 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
728 | 729 | ||
729 | private handleLiveViewsChange (newViewers: number) { | 730 | private handleLiveViewsChange (newViewers: number) { |
730 | if (!this.video) { | 731 | if (!this.video) { |
731 | console.error('Cannot update video live views because video is no defined.') | 732 | logger.error('Cannot update video live views because video is no defined.') |
732 | return | 733 | return |
733 | } | 734 | } |
734 | 735 | ||
735 | console.log('Updating live views.') | 736 | logger.info('Updating live views.') |
736 | 737 | ||
737 | this.video.viewers = newViewers | 738 | this.video.viewers = newViewers |
738 | } | 739 | } |