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 | |
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')
16 files changed, 55 insertions, 47 deletions
diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts index 8781c16f5..32d3b0093 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts +++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts | |||
@@ -8,13 +8,14 @@ import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } | |||
8 | import { Account, Actor, DropdownAction, Video, VideoService } from '@app/shared/shared-main' | 8 | import { Account, Actor, DropdownAction, Video, VideoService } from '@app/shared/shared-main' |
9 | import { AbuseService, BlocklistService, VideoBlockService } from '@app/shared/shared-moderation' | 9 | import { AbuseService, BlocklistService, VideoBlockService } from '@app/shared/shared-moderation' |
10 | import { VideoCommentService } from '@app/shared/shared-video-comment' | 10 | import { VideoCommentService } from '@app/shared/shared-video-comment' |
11 | import { logger } from '@root-helpers/logger' | ||
11 | import { AbuseState, AdminAbuse } from '@shared/models' | 12 | import { AbuseState, AdminAbuse } from '@shared/models' |
12 | import { AdvancedInputFilter } from '../shared-forms' | 13 | import { AdvancedInputFilter } from '../shared-forms' |
13 | import { AbuseMessageModalComponent } from './abuse-message-modal.component' | 14 | import { AbuseMessageModalComponent } from './abuse-message-modal.component' |
14 | import { ModerationCommentModalComponent } from './moderation-comment-modal.component' | 15 | import { ModerationCommentModalComponent } from './moderation-comment-modal.component' |
15 | import { ProcessedAbuse } from './processed-abuse.model' | 16 | import { ProcessedAbuse } from './processed-abuse.model' |
16 | 17 | ||
17 | const logger = debug('peertube:moderation:AbuseListTableComponent') | 18 | const debugLogger = debug('peertube:moderation:AbuseListTableComponent') |
18 | 19 | ||
19 | @Component({ | 20 | @Component({ |
20 | selector: 'my-abuse-list-table', | 21 | selector: 'my-abuse-list-table', |
@@ -158,7 +159,7 @@ export class AbuseListTableComponent extends RestTable implements OnInit { | |||
158 | const abuse = this.abuses.find(a => a.id === event.abuseId) | 159 | const abuse = this.abuses.find(a => a.id === event.abuseId) |
159 | 160 | ||
160 | if (!abuse) { | 161 | if (!abuse) { |
161 | console.error('Cannot find abuse %d.', event.abuseId) | 162 | logger.error(`Cannot find abuse ${event.abuseId}`) |
162 | return | 163 | return |
163 | } | 164 | } |
164 | 165 | ||
@@ -177,7 +178,7 @@ export class AbuseListTableComponent extends RestTable implements OnInit { | |||
177 | } | 178 | } |
178 | 179 | ||
179 | protected reloadData () { | 180 | protected reloadData () { |
180 | logger('Loading data.') | 181 | debugLogger('Loading data.') |
181 | 182 | ||
182 | const options = { | 183 | const options = { |
183 | pagination: this.pagination, | 184 | pagination: this.pagination, |
diff --git a/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts b/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts index 6c8dc6d35..d24a5d58d 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts +++ b/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts | |||
@@ -3,6 +3,7 @@ import { AuthService, HtmlRendererService, Notifier } from '@app/core' | |||
3 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | 3 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' |
4 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 4 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
5 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' | 5 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' |
6 | import { logger } from '@root-helpers/logger' | ||
6 | import { AbuseMessage, UserAbuse } from '@shared/models' | 7 | import { AbuseMessage, UserAbuse } from '@shared/models' |
7 | import { ABUSE_MESSAGE_VALIDATOR } from '../form-validators/abuse-validators' | 8 | import { ABUSE_MESSAGE_VALIDATOR } from '../form-validators/abuse-validators' |
8 | import { AbuseService } from '../shared-moderation' | 9 | import { AbuseService } from '../shared-moderation' |
@@ -72,7 +73,7 @@ export class AbuseMessageModalComponent extends FormReactive implements OnInit { | |||
72 | 73 | ||
73 | error: err => { | 74 | error: err => { |
74 | this.sendingMessage = false | 75 | this.sendingMessage = false |
75 | console.error(err) | 76 | logger.error(err) |
76 | this.notifier.error('Sorry but you cannot send this message. Please retry later') | 77 | this.notifier.error('Sorry but you cannot send this message. Please retry later') |
77 | } | 78 | } |
78 | }) | 79 | }) |
diff --git a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts index a959b336d..d738a644e 100644 --- a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts +++ b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts | |||
@@ -20,6 +20,7 @@ import { | |||
20 | VideosListMarkupComponent | 20 | VideosListMarkupComponent |
21 | } from './peertube-custom-tags' | 21 | } from './peertube-custom-tags' |
22 | import { CustomMarkupComponent } from './peertube-custom-tags/shared' | 22 | import { CustomMarkupComponent } from './peertube-custom-tags/shared' |
23 | import { logger } from '@root-helpers/logger' | ||
23 | 24 | ||
24 | type AngularBuilderFunction = (el: HTMLElement) => ComponentRef<CustomMarkupComponent> | 25 | type AngularBuilderFunction = (el: HTMLElement) => ComponentRef<CustomMarkupComponent> |
25 | type HTMLBuilderFunction = (el: HTMLElement) => HTMLElement | 26 | type HTMLBuilderFunction = (el: HTMLElement) => HTMLElement |
@@ -70,7 +71,7 @@ export class CustomMarkupService { | |||
70 | // Insert as first child | 71 | // Insert as first child |
71 | e.insertBefore(element, e.firstChild) | 72 | e.insertBefore(element, e.firstChild) |
72 | } catch (err) { | 73 | } catch (err) { |
73 | console.error('Cannot inject component %s.', selector, err) | 74 | logger.error(`Cannot inject component ${selector}`, err) |
74 | } | 75 | } |
75 | }) | 76 | }) |
76 | } | 77 | } |
@@ -90,7 +91,7 @@ export class CustomMarkupService { | |||
90 | 91 | ||
91 | this.dynamicElementService.injectElement(e, component) | 92 | this.dynamicElementService.injectElement(e, component) |
92 | } catch (err) { | 93 | } catch (err) { |
93 | console.error('Cannot inject component %s.', selector, err) | 94 | logger.error(`Cannot inject component ${selector}`, err) |
94 | } | 95 | } |
95 | }) | 96 | }) |
96 | } | 97 | } |
diff --git a/client/src/app/shared/shared-forms/advanced-input-filter.component.ts b/client/src/app/shared/shared-forms/advanced-input-filter.component.ts index d8aeaa0fa..929438749 100644 --- a/client/src/app/shared/shared-forms/advanced-input-filter.component.ts +++ b/client/src/app/shared/shared-forms/advanced-input-filter.component.ts | |||
@@ -16,7 +16,7 @@ export type AdvancedInputFilterChild = { | |||
16 | value: string | 16 | value: string |
17 | } | 17 | } |
18 | 18 | ||
19 | const logger = debug('peertube:AdvancedInputFilterComponent') | 19 | const debugLogger = debug('peertube:AdvancedInputFilterComponent') |
20 | 20 | ||
21 | @Component({ | 21 | @Component({ |
22 | selector: 'my-advanced-input-filter', | 22 | selector: 'my-advanced-input-filter', |
@@ -98,7 +98,7 @@ export class AdvancedInputFilterComponent implements OnInit, AfterViewInit { | |||
98 | .subscribe(params => { | 98 | .subscribe(params => { |
99 | const search = params.search || '' | 99 | const search = params.search || '' |
100 | 100 | ||
101 | logger('On route search change "%s".', search) | 101 | debugLogger('On route search change "%s".', search) |
102 | 102 | ||
103 | if (this.searchValue === search) return | 103 | if (this.searchValue === search) return |
104 | 104 | ||
@@ -132,7 +132,7 @@ export class AdvancedInputFilterComponent implements OnInit, AfterViewInit { | |||
132 | return | 132 | return |
133 | } | 133 | } |
134 | 134 | ||
135 | logger('On search "%s".', this.searchValue) | 135 | debugLogger('On search "%s".', this.searchValue) |
136 | 136 | ||
137 | this.search.emit(this.searchValue) | 137 | this.search.emit(this.searchValue) |
138 | } | 138 | } |
diff --git a/client/src/app/shared/shared-main/angular/defer-loading.directive.ts b/client/src/app/shared/shared-main/angular/defer-loading.directive.ts index 9a10e90e3..53d6e70ba 100644 --- a/client/src/app/shared/shared-main/angular/defer-loading.directive.ts +++ b/client/src/app/shared/shared-main/angular/defer-loading.directive.ts | |||
@@ -13,7 +13,7 @@ import { | |||
13 | ViewContainerRef | 13 | ViewContainerRef |
14 | } from '@angular/core' | 14 | } from '@angular/core' |
15 | 15 | ||
16 | const logger = debug('peertube:main:DeferLoadingDirective') | 16 | const debugLogger = debug('peertube:main:DeferLoadingDirective') |
17 | 17 | ||
18 | @Directive({ | 18 | @Directive({ |
19 | selector: '[myDeferLoading]' | 19 | selector: '[myDeferLoading]' |
@@ -52,7 +52,7 @@ export class DeferLoadingDirective implements AfterViewInit, OnDestroy { | |||
52 | load () { | 52 | load () { |
53 | if (this.isLoaded()) return | 53 | if (this.isLoaded()) return |
54 | 54 | ||
55 | logger('Loading component') | 55 | debugLogger('Loading component') |
56 | 56 | ||
57 | this.viewContainer.clear() | 57 | this.viewContainer.clear() |
58 | this.view = this.viewContainer.createEmbeddedView(this.template, {}, 0) | 58 | this.view = this.viewContainer.createEmbeddedView(this.template, {}, 0) |
diff --git a/client/src/app/shared/shared-main/misc/list-overflow.component.ts b/client/src/app/shared/shared-main/misc/list-overflow.component.ts index 541991f74..7e4e1b1d1 100644 --- a/client/src/app/shared/shared-main/misc/list-overflow.component.ts +++ b/client/src/app/shared/shared-main/misc/list-overflow.component.ts | |||
@@ -17,7 +17,7 @@ import { ScreenService } from '@app/core' | |||
17 | import { NgbDropdown, NgbModal } from '@ng-bootstrap/ng-bootstrap' | 17 | import { NgbDropdown, NgbModal } from '@ng-bootstrap/ng-bootstrap' |
18 | import * as debug from 'debug' | 18 | import * as debug from 'debug' |
19 | 19 | ||
20 | const logger = debug('peertube:main:ListOverflowItem') | 20 | const debugLogger = debug('peertube:main:ListOverflowItem') |
21 | 21 | ||
22 | export interface ListOverflowItem { | 22 | export interface ListOverflowItem { |
23 | label: string | 23 | label: string |
@@ -66,7 +66,7 @@ export class ListOverflowComponent<T extends ListOverflowItem> implements AfterV | |||
66 | let showItemsUntilIndexExcluded: number | 66 | let showItemsUntilIndexExcluded: number |
67 | let accWidth = 0 | 67 | let accWidth = 0 |
68 | 68 | ||
69 | logger('Parent width is %d', parentWidth) | 69 | debugLogger('Parent width is %d', parentWidth) |
70 | 70 | ||
71 | for (const [ index, el ] of this.itemsRendered.toArray().entries()) { | 71 | for (const [ index, el ] of this.itemsRendered.toArray().entries()) { |
72 | accWidth += el.nativeElement.getBoundingClientRect().width | 72 | accWidth += el.nativeElement.getBoundingClientRect().width |
@@ -79,7 +79,7 @@ export class ListOverflowComponent<T extends ListOverflowItem> implements AfterV | |||
79 | e.style.visibility = shouldBeVisible ? 'inherit' : 'hidden' | 79 | e.style.visibility = shouldBeVisible ? 'inherit' : 'hidden' |
80 | } | 80 | } |
81 | 81 | ||
82 | logger('Accumulated children width is %d so exclude index is %d', accWidth, showItemsUntilIndexExcluded) | 82 | debugLogger('Accumulated children width is %d so exclude index is %d', accWidth, showItemsUntilIndexExcluded) |
83 | 83 | ||
84 | this.showItemsUntilIndexExcluded = showItemsUntilIndexExcluded | 84 | this.showItemsUntilIndexExcluded = showItemsUntilIndexExcluded |
85 | this.cdr.markForCheck() | 85 | this.cdr.markForCheck() |
diff --git a/client/src/app/shared/shared-main/users/user-notification.model.ts b/client/src/app/shared/shared-main/users/user-notification.model.ts index a2367166e..bf8870a79 100644 --- a/client/src/app/shared/shared-main/users/user-notification.model.ts +++ b/client/src/app/shared/shared-main/users/user-notification.model.ts | |||
@@ -2,6 +2,7 @@ import { AuthUser } from '@app/core' | |||
2 | import { Account } from '@app/shared/shared-main/account/account.model' | 2 | import { Account } from '@app/shared/shared-main/account/account.model' |
3 | import { Actor } from '@app/shared/shared-main/account/actor.model' | 3 | import { Actor } from '@app/shared/shared-main/account/actor.model' |
4 | import { VideoChannel } from '@app/shared/shared-main/video-channel/video-channel.model' | 4 | import { VideoChannel } from '@app/shared/shared-main/video-channel/video-channel.model' |
5 | import { logger } from '@root-helpers/logger' | ||
5 | import { | 6 | import { |
6 | AbuseState, | 7 | AbuseState, |
7 | ActorInfo, | 8 | ActorInfo, |
@@ -234,7 +235,7 @@ export class UserNotification implements UserNotificationServer { | |||
234 | } | 235 | } |
235 | } catch (err) { | 236 | } catch (err) { |
236 | this.type = null | 237 | this.type = null |
237 | console.error(err) | 238 | logger.error(err) |
238 | } | 239 | } |
239 | } | 240 | } |
240 | 241 | ||
diff --git a/client/src/app/shared/shared-search/find-in-bulk.service.ts b/client/src/app/shared/shared-search/find-in-bulk.service.ts index 117685cc6..d2f8c3213 100644 --- a/client/src/app/shared/shared-search/find-in-bulk.service.ts +++ b/client/src/app/shared/shared-search/find-in-bulk.service.ts | |||
@@ -9,7 +9,7 @@ import { VideoPlaylist } from '../shared-video-playlist' | |||
9 | import { SearchService } from './search.service' | 9 | import { SearchService } from './search.service' |
10 | import { AdvancedSearch } from './advanced-search.model' | 10 | import { AdvancedSearch } from './advanced-search.model' |
11 | 11 | ||
12 | const logger = debug('peertube:search:FindInBulkService') | 12 | const debugLogger = debug('peertube:search:FindInBulkService') |
13 | 13 | ||
14 | type BulkObservables <P extends number | string, R> = { | 14 | type BulkObservables <P extends number | string, R> = { |
15 | notifier: Subject<P> | 15 | notifier: Subject<P> |
@@ -36,7 +36,7 @@ export class FindInBulkService { | |||
36 | } | 36 | } |
37 | 37 | ||
38 | getVideo (uuid: string): Observable<Video> { | 38 | getVideo (uuid: string): Observable<Video> { |
39 | logger('Schedule video fetch for uuid %s.', uuid) | 39 | debugLogger('Schedule video fetch for uuid %s.', uuid) |
40 | 40 | ||
41 | return this.getData({ | 41 | return this.getData({ |
42 | observableObject: this.getVideoInBulk, | 42 | observableObject: this.getVideoInBulk, |
@@ -46,7 +46,7 @@ export class FindInBulkService { | |||
46 | } | 46 | } |
47 | 47 | ||
48 | getChannel (handle: string): Observable<VideoChannel> { | 48 | getChannel (handle: string): Observable<VideoChannel> { |
49 | logger('Schedule channel fetch for handle %s.', handle) | 49 | debugLogger('Schedule channel fetch for handle %s.', handle) |
50 | 50 | ||
51 | return this.getData({ | 51 | return this.getData({ |
52 | observableObject: this.getChannelInBulk, | 52 | observableObject: this.getChannelInBulk, |
@@ -56,7 +56,7 @@ export class FindInBulkService { | |||
56 | } | 56 | } |
57 | 57 | ||
58 | getPlaylist (uuid: string): Observable<VideoPlaylist> { | 58 | getPlaylist (uuid: string): Observable<VideoPlaylist> { |
59 | logger('Schedule playlist fetch for uuid %s.', uuid) | 59 | debugLogger('Schedule playlist fetch for uuid %s.', uuid) |
60 | 60 | ||
61 | return this.getData({ | 61 | return this.getData({ |
62 | observableObject: this.getPlaylistInBulk, | 62 | observableObject: this.getPlaylistInBulk, |
@@ -94,7 +94,7 @@ export class FindInBulkService { | |||
94 | } | 94 | } |
95 | 95 | ||
96 | private getVideosInBulk (uuids: string[]) { | 96 | private getVideosInBulk (uuids: string[]) { |
97 | logger('Fetching videos %s.', uuids.join(', ')) | 97 | debugLogger('Fetching videos %s.', uuids.join(', ')) |
98 | 98 | ||
99 | return this.searchService.searchVideos({ | 99 | return this.searchService.searchVideos({ |
100 | uuids, | 100 | uuids, |
@@ -104,7 +104,7 @@ export class FindInBulkService { | |||
104 | } | 104 | } |
105 | 105 | ||
106 | private getChannelsInBulk (handles: string[]) { | 106 | private getChannelsInBulk (handles: string[]) { |
107 | logger('Fetching channels %s.', handles.join(', ')) | 107 | debugLogger('Fetching channels %s.', handles.join(', ')) |
108 | 108 | ||
109 | return this.searchService.searchVideoChannels({ | 109 | return this.searchService.searchVideoChannels({ |
110 | handles, | 110 | handles, |
@@ -114,7 +114,7 @@ export class FindInBulkService { | |||
114 | } | 114 | } |
115 | 115 | ||
116 | private getPlaylistsInBulk (uuids: string[]) { | 116 | private getPlaylistsInBulk (uuids: string[]) { |
117 | logger('Fetching playlists %s.', uuids.join(', ')) | 117 | debugLogger('Fetching playlists %s.', uuids.join(', ')) |
118 | 118 | ||
119 | return this.searchService.searchVideoPlaylists({ | 119 | return this.searchService.searchVideoPlaylists({ |
120 | uuids, | 120 | uuids, |
diff --git a/client/src/app/shared/shared-user-subscription/remote-subscribe.component.ts b/client/src/app/shared/shared-user-subscription/remote-subscribe.component.ts index 369692715..7bcfdd8aa 100644 --- a/client/src/app/shared/shared-user-subscription/remote-subscribe.component.ts +++ b/client/src/app/shared/shared-user-subscription/remote-subscribe.component.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { Component, Input, OnInit } from '@angular/core' | 1 | import { Component, Input, OnInit } from '@angular/core' |
2 | import { Notifier } from '@app/core' | 2 | import { Notifier } from '@app/core' |
3 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | 3 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' |
4 | import { logger } from '@root-helpers/logger' | ||
4 | import { USER_HANDLE_VALIDATOR } from '../form-validators/user-validators' | 5 | import { USER_HANDLE_VALIDATOR } from '../form-validators/user-validators' |
5 | 6 | ||
6 | @Component({ | 7 | @Component({ |
@@ -59,7 +60,7 @@ export class RemoteSubscribeComponent extends FormReactive implements OnInit { | |||
59 | }) | 60 | }) |
60 | .then(window.open) | 61 | .then(window.open) |
61 | .catch(err => { | 62 | .catch(err => { |
62 | console.error(err) | 63 | logger.error(err) |
63 | 64 | ||
64 | this.notifier.error($localize`Cannot fetch information of this remote account`) | 65 | this.notifier.error($localize`Cannot fetch information of this remote account`) |
65 | }) | 66 | }) |
diff --git a/client/src/app/shared/shared-user-subscription/user-subscription.service.ts b/client/src/app/shared/shared-user-subscription/user-subscription.service.ts index 33a2d04fd..9cf6b4d16 100644 --- a/client/src/app/shared/shared-user-subscription/user-subscription.service.ts +++ b/client/src/app/shared/shared-user-subscription/user-subscription.service.ts | |||
@@ -9,7 +9,7 @@ import { Video, VideoChannel, VideoChannelService, VideoService } from '@app/sha | |||
9 | import { ActorFollow, ResultList, VideoChannel as VideoChannelServer, VideoSortField } from '@shared/models' | 9 | import { ActorFollow, ResultList, VideoChannel as VideoChannelServer, VideoSortField } from '@shared/models' |
10 | import { environment } from '../../../environments/environment' | 10 | import { environment } from '../../../environments/environment' |
11 | 11 | ||
12 | const logger = debug('peertube:subscriptions:UserSubscriptionService') | 12 | const debugLogger = debug('peertube:subscriptions:UserSubscriptionService') |
13 | 13 | ||
14 | type SubscriptionExistResult = { [ uri: string ]: boolean } | 14 | type SubscriptionExistResult = { [ uri: string ]: boolean } |
15 | type SubscriptionExistResultObservable = { [ uri: string ]: Observable<boolean> } | 15 | type SubscriptionExistResultObservable = { [ uri: string ]: Observable<boolean> } |
@@ -176,17 +176,17 @@ export class UserSubscriptionService { | |||
176 | } | 176 | } |
177 | 177 | ||
178 | doesSubscriptionExist (nameWithHost: string) { | 178 | doesSubscriptionExist (nameWithHost: string) { |
179 | logger('Running subscription check for %d.', nameWithHost) | 179 | debugLogger('Running subscription check for %d.', nameWithHost) |
180 | 180 | ||
181 | if (nameWithHost in this.myAccountSubscriptionCache) { | 181 | if (nameWithHost in this.myAccountSubscriptionCache) { |
182 | logger('Found cache for %d.', nameWithHost) | 182 | debugLogger('Found cache for %d.', nameWithHost) |
183 | 183 | ||
184 | return of(this.myAccountSubscriptionCache[nameWithHost]) | 184 | return of(this.myAccountSubscriptionCache[nameWithHost]) |
185 | } | 185 | } |
186 | 186 | ||
187 | this.existsSubject.next(nameWithHost) | 187 | this.existsSubject.next(nameWithHost) |
188 | 188 | ||
189 | logger('Fetching from network for %d.', nameWithHost) | 189 | debugLogger('Fetching from network for %d.', nameWithHost) |
190 | return this.existsObservable.pipe( | 190 | return this.existsObservable.pipe( |
191 | filter(existsResult => existsResult[nameWithHost] !== undefined), | 191 | filter(existsResult => existsResult[nameWithHost] !== undefined), |
192 | map(existsResult => existsResult[nameWithHost]), | 192 | map(existsResult => existsResult[nameWithHost]), |
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 | }) |
diff --git a/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts b/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts index e4972ec10..e019fdd26 100644 --- a/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts +++ b/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts | |||
@@ -16,7 +16,7 @@ import { | |||
16 | import { VIDEO_PLAYLIST_DISPLAY_NAME_VALIDATOR } from '../form-validators/video-playlist-validators' | 16 | import { VIDEO_PLAYLIST_DISPLAY_NAME_VALIDATOR } from '../form-validators/video-playlist-validators' |
17 | import { CachedPlaylist, VideoPlaylistService } from './video-playlist.service' | 17 | import { CachedPlaylist, VideoPlaylistService } from './video-playlist.service' |
18 | 18 | ||
19 | const logger = debug('peertube:playlists:VideoAddToPlaylistComponent') | 19 | const debugLogger = debug('peertube:playlists:VideoAddToPlaylistComponent') |
20 | 20 | ||
21 | type PlaylistElement = { | 21 | type PlaylistElement = { |
22 | enabled: boolean | 22 | enabled: boolean |
@@ -110,7 +110,7 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit, | |||
110 | } | 110 | } |
111 | 111 | ||
112 | reload () { | 112 | reload () { |
113 | logger('Reloading component') | 113 | debugLogger('Reloading component') |
114 | 114 | ||
115 | this.videoPlaylists = [] | 115 | this.videoPlaylists = [] |
116 | this.videoPlaylistSearch = undefined | 116 | this.videoPlaylistSearch = undefined |
@@ -121,7 +121,7 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit, | |||
121 | } | 121 | } |
122 | 122 | ||
123 | load () { | 123 | load () { |
124 | logger('Loading component') | 124 | debugLogger('Loading component') |
125 | 125 | ||
126 | this.listenToVideoPlaylistChange() | 126 | this.listenToVideoPlaylistChange() |
127 | 127 | ||
@@ -331,7 +331,7 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit, | |||
331 | } | 331 | } |
332 | 332 | ||
333 | private rebuildPlaylists (existResult: VideoExistInPlaylist[]) { | 333 | private rebuildPlaylists (existResult: VideoExistInPlaylist[]) { |
334 | logger('Got existing results for %d.', this.video.id, existResult) | 334 | debugLogger('Got existing results for %d.', this.video.id, existResult) |
335 | 335 | ||
336 | const oldPlaylists = this.videoPlaylists | 336 | const oldPlaylists = this.videoPlaylists |
337 | 337 | ||
@@ -359,7 +359,7 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit, | |||
359 | this.videoPlaylists.push(playlistSummary) | 359 | this.videoPlaylists.push(playlistSummary) |
360 | } | 360 | } |
361 | 361 | ||
362 | logger('Rebuilt playlist state for video %d.', this.video.id, this.videoPlaylists) | 362 | debugLogger('Rebuilt playlist state for video %d.', this.video.id, this.videoPlaylists) |
363 | 363 | ||
364 | this.cd.markForCheck() | 364 | this.cd.markForCheck() |
365 | } | 365 | } |
diff --git a/client/src/app/shared/shared-video-playlist/video-playlist.service.ts b/client/src/app/shared/shared-video-playlist/video-playlist.service.ts index db9f78a7a..81ae0f292 100644 --- a/client/src/app/shared/shared-video-playlist/video-playlist.service.ts +++ b/client/src/app/shared/shared-video-playlist/video-playlist.service.ts | |||
@@ -23,7 +23,7 @@ import { environment } from '../../../environments/environment' | |||
23 | import { VideoPlaylistElement } from './video-playlist-element.model' | 23 | import { VideoPlaylistElement } from './video-playlist-element.model' |
24 | import { VideoPlaylist } from './video-playlist.model' | 24 | import { VideoPlaylist } from './video-playlist.model' |
25 | 25 | ||
26 | const logger = debug('peertube:playlists:VideoPlaylistService') | 26 | const debugLogger = debug('peertube:playlists:VideoPlaylistService') |
27 | 27 | ||
28 | export type CachedPlaylist = VideoPlaylist | { id: number, displayName: string } | 28 | export type CachedPlaylist = VideoPlaylist | { id: number, displayName: string } |
29 | 29 | ||
@@ -287,15 +287,15 @@ export class VideoPlaylistService { | |||
287 | } | 287 | } |
288 | 288 | ||
289 | runPlaylistCheck (videoId: number) { | 289 | runPlaylistCheck (videoId: number) { |
290 | logger('Running playlist check.') | 290 | debugLogger('Running playlist check.') |
291 | 291 | ||
292 | if (this.videoExistsCache[videoId]) { | 292 | if (this.videoExistsCache[videoId]) { |
293 | logger('Found cache for %d.', videoId) | 293 | debugLogger('Found cache for %d.', videoId) |
294 | 294 | ||
295 | return this.videoExistsInPlaylistCacheSubject.next({ [videoId]: this.videoExistsCache[videoId] }) | 295 | return this.videoExistsInPlaylistCacheSubject.next({ [videoId]: this.videoExistsCache[videoId] }) |
296 | } | 296 | } |
297 | 297 | ||
298 | logger('Fetching from network for %d.', videoId) | 298 | debugLogger('Fetching from network for %d.', videoId) |
299 | return this.videoExistsInPlaylistNotifier.next(videoId) | 299 | return this.videoExistsInPlaylistNotifier.next(videoId) |
300 | } | 300 | } |
301 | 301 | ||