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/shared/shared-video-miniature | |
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/shared/shared-video-miniature')
4 files changed, 14 insertions, 11 deletions
diff --git a/client/src/app/shared/shared-video-miniature/video-download.component.ts b/client/src/app/shared/shared-video-miniature/video-download.component.ts index bbda39c2d..47482caaa 100644 --- a/client/src/app/shared/shared-video-miniature/video-download.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-download.component.ts | |||
@@ -4,6 +4,7 @@ import { tap } from 'rxjs/operators' | |||
4 | import { Component, ElementRef, Inject, LOCALE_ID, ViewChild } from '@angular/core' | 4 | import { Component, ElementRef, Inject, LOCALE_ID, ViewChild } from '@angular/core' |
5 | import { AuthService, HooksService, Notifier } from '@app/core' | 5 | import { AuthService, HooksService, Notifier } from '@app/core' |
6 | import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' | 6 | import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' |
7 | import { logger } from '@root-helpers/logger' | ||
7 | import { VideoCaption, VideoFile, VideoPrivacy } from '@shared/models' | 8 | import { VideoCaption, VideoFile, VideoPrivacy } from '@shared/models' |
8 | import { BytesPipe, NumberFormatterPipe, VideoDetails, VideoService } from '../shared-main' | 9 | import { BytesPipe, NumberFormatterPipe, VideoDetails, VideoService } from '../shared-main' |
9 | 10 | ||
@@ -142,7 +143,7 @@ export class VideoDownloadComponent { | |||
142 | .find(f => f.resolution.id === this.resolutionId) | 143 | .find(f => f.resolution.id === this.resolutionId) |
143 | 144 | ||
144 | if (!file) { | 145 | if (!file) { |
145 | console.error('Could not find file with resolution %d.', this.resolutionId) | 146 | logger.error(`Could not find file with resolution ${this.resolutionId}`) |
146 | return undefined | 147 | return undefined |
147 | } | 148 | } |
148 | 149 | ||
@@ -175,7 +176,7 @@ export class VideoDownloadComponent { | |||
175 | .find(c => c.language.id === this.subtitleLanguageId) | 176 | .find(c => c.language.id === this.subtitleLanguageId) |
176 | 177 | ||
177 | if (!caption) { | 178 | if (!caption) { |
178 | console.error('Cannot find caption %s.', this.subtitleLanguageId) | 179 | logger.error(`Cannot find caption ${this.subtitleLanguageId}`) |
179 | return undefined | 180 | return undefined |
180 | } | 181 | } |
181 | 182 | ||
diff --git a/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts b/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts index 7b806248b..a5da9ebf3 100644 --- a/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts | |||
@@ -8,7 +8,7 @@ import { UserRight } from '@shared/models' | |||
8 | import { PeertubeModalService } from '../shared-main' | 8 | import { PeertubeModalService } from '../shared-main' |
9 | import { VideoFilters } from './video-filters.model' | 9 | import { VideoFilters } from './video-filters.model' |
10 | 10 | ||
11 | const logger = debug('peertube:videos:VideoFiltersHeaderComponent') | 11 | const debugLogger = debug('peertube:videos:VideoFiltersHeaderComponent') |
12 | 12 | ||
13 | @Component({ | 13 | @Component({ |
14 | selector: 'my-video-filters-header', | 14 | selector: 'my-video-filters-header', |
@@ -54,7 +54,7 @@ export class VideoFiltersHeaderComponent implements OnInit, OnDestroy { | |||
54 | }) | 54 | }) |
55 | 55 | ||
56 | this.form.valueChanges.subscribe(values => { | 56 | this.form.valueChanges.subscribe(values => { |
57 | logger('Loading values from form: %O', values) | 57 | debugLogger('Loading values from form: %O', values) |
58 | 58 | ||
59 | this.filters.load(values) | 59 | this.filters.load(values) |
60 | this.filtersChanged.emit() | 60 | this.filtersChanged.emit() |
@@ -105,6 +105,6 @@ export class VideoFiltersHeaderComponent implements OnInit, OnDestroy { | |||
105 | const defaultValues = this.filters.toFormObject() | 105 | const defaultValues = this.filters.toFormObject() |
106 | this.form.patchValue(defaultValues, { emitEvent }) | 106 | this.form.patchValue(defaultValues, { emitEvent }) |
107 | 107 | ||
108 | logger('Patched form: %O', defaultValues) | 108 | debugLogger('Patched form: %O', defaultValues) |
109 | } | 109 | } |
110 | } | 110 | } |
diff --git a/client/src/app/shared/shared-video-miniature/videos-list.component.ts b/client/src/app/shared/shared-video-miniature/videos-list.component.ts index 38a80b973..508a189fd 100644 --- a/client/src/app/shared/shared-video-miniature/videos-list.component.ts +++ b/client/src/app/shared/shared-video-miniature/videos-list.component.ts | |||
@@ -14,13 +14,14 @@ import { | |||
14 | UserService | 14 | UserService |
15 | } from '@app/core' | 15 | } from '@app/core' |
16 | import { GlobalIconName } from '@app/shared/shared-icons' | 16 | import { GlobalIconName } from '@app/shared/shared-icons' |
17 | import { logger } from '@root-helpers/logger' | ||
17 | import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@shared/core-utils' | 18 | import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@shared/core-utils' |
18 | import { ResultList, UserRight, VideoSortField } from '@shared/models' | 19 | import { ResultList, UserRight, VideoSortField } from '@shared/models' |
19 | import { Syndication, Video } from '../shared-main' | 20 | import { Syndication, Video } from '../shared-main' |
20 | import { VideoFilters, VideoFilterScope } from './video-filters.model' | 21 | import { VideoFilters, VideoFilterScope } from './video-filters.model' |
21 | import { MiniatureDisplayOptions } from './video-miniature.component' | 22 | import { MiniatureDisplayOptions } from './video-miniature.component' |
22 | 23 | ||
23 | const logger = debug('peertube:videos:VideosListComponent') | 24 | const debugLogger = debug('peertube:videos:VideosListComponent') |
24 | 25 | ||
25 | export type HeaderAction = { | 26 | export type HeaderAction = { |
26 | iconName: GlobalIconName | 27 | iconName: GlobalIconName |
@@ -245,7 +246,7 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy { | |||
245 | error: err => { | 246 | error: err => { |
246 | const message = $localize`Cannot load more videos. Try again later.` | 247 | const message = $localize`Cannot load more videos. Try again later.` |
247 | 248 | ||
248 | console.error(message, { err }) | 249 | logger.error(message, err) |
249 | this.notifier.error(message) | 250 | this.notifier.error(message) |
250 | } | 251 | } |
251 | }) | 252 | }) |
@@ -323,7 +324,7 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy { | |||
323 | } | 324 | } |
324 | 325 | ||
325 | onFiltersChanged (customizedByUser: boolean) { | 326 | onFiltersChanged (customizedByUser: boolean) { |
326 | logger('Running on filters changed') | 327 | debugLogger('Running on filters changed') |
327 | 328 | ||
328 | this.updateUrl(customizedByUser) | 329 | this.updateUrl(customizedByUser) |
329 | 330 | ||
@@ -364,7 +365,7 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy { | |||
364 | if (!items || items.length === 0) this.syndicationItems = undefined | 365 | if (!items || items.length === 0) this.syndicationItems = undefined |
365 | else this.syndicationItems = items | 366 | else this.syndicationItems = items |
366 | }) | 367 | }) |
367 | .catch(err => console.error('Cannot get syndication items.', err)) | 368 | .catch(err => logger.error('Cannot get syndication items.', err)) |
368 | } | 369 | } |
369 | 370 | ||
370 | private updateUrl (customizedByUser: boolean) { | 371 | private updateUrl (customizedByUser: boolean) { |
@@ -375,7 +376,7 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy { | |||
375 | ? { ...baseQuery, c: customizedByUser } | 376 | ? { ...baseQuery, c: customizedByUser } |
376 | : baseQuery | 377 | : baseQuery |
377 | 378 | ||
378 | logger('Will inject %O in URL query', queryParams) | 379 | debugLogger('Will inject %O in URL query', queryParams) |
379 | 380 | ||
380 | const baseRoute = this.baseRouteBuilderFunction | 381 | const baseRoute = this.baseRouteBuilderFunction |
381 | ? this.baseRouteBuilderFunction(this.filters) | 382 | ? this.baseRouteBuilderFunction(this.filters) |
diff --git a/client/src/app/shared/shared-video-miniature/videos-selection.component.ts b/client/src/app/shared/shared-video-miniature/videos-selection.component.ts index bac828fba..fa3c79bbb 100644 --- a/client/src/app/shared/shared-video-miniature/videos-selection.component.ts +++ b/client/src/app/shared/shared-video-miniature/videos-selection.component.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { Observable, Subject } from 'rxjs' | 1 | import { Observable, Subject } from 'rxjs' |
2 | import { AfterContentInit, Component, ContentChildren, EventEmitter, Input, Output, QueryList, TemplateRef } from '@angular/core' | 2 | import { AfterContentInit, Component, ContentChildren, EventEmitter, Input, Output, QueryList, TemplateRef } from '@angular/core' |
3 | import { ComponentPagination, Notifier, User } from '@app/core' | 3 | import { ComponentPagination, Notifier, User } from '@app/core' |
4 | import { logger } from '@root-helpers/logger' | ||
4 | import { ResultList, VideoSortField } from '@shared/models' | 5 | import { ResultList, VideoSortField } from '@shared/models' |
5 | import { PeerTubeTemplateDirective, Video } from '../shared-main' | 6 | import { PeerTubeTemplateDirective, Video } from '../shared-main' |
6 | import { MiniatureDisplayOptions } from './video-miniature.component' | 7 | import { MiniatureDisplayOptions } from './video-miniature.component' |
@@ -128,7 +129,7 @@ export class VideosSelectionComponent implements AfterContentInit { | |||
128 | error: err => { | 129 | error: err => { |
129 | const message = $localize`Cannot load more videos. Try again later.` | 130 | const message = $localize`Cannot load more videos. Try again later.` |
130 | 131 | ||
131 | console.error(message, { err }) | 132 | logger.error(message, err) |
132 | this.notifier.error(message) | 133 | this.notifier.error(message) |
133 | } | 134 | } |
134 | }) | 135 | }) |