aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/+admin/overview/users/user-list/user-list.component.ts5
-rw-r--r--client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts3
-rw-r--r--client/src/app/+admin/system/logs/log-row.model.ts7
-rw-r--r--client/src/app/+admin/system/logs/logs.component.ts6
-rw-r--r--client/src/app/+admin/system/logs/logs.service.ts4
-rw-r--r--client/src/app/+plugin-pages/plugin-pages.component.ts3
-rw-r--r--client/src/app/+search/shared/abstract-lazy-load.resolver.ts5
-rw-r--r--client/src/app/+video-studio/edit/video-studio-edit.component.ts3
-rw-r--r--client/src/app/+videos/+video-edit/shared/video-edit.component.ts3
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts3
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts3
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts3
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts5
-rw-r--r--client/src/app/+videos/+video-edit/video-update.component.ts5
-rw-r--r--client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts3
-rw-r--r--client/src/app/+videos/+video-watch/video-watch.component.ts13
-rw-r--r--client/src/app/app.component.ts9
-rw-r--r--client/src/app/core/auth/auth.service.ts12
-rw-r--r--client/src/app/core/notification/notifier.service.ts7
-rw-r--r--client/src/app/core/plugins/hooks.service.ts3
-rw-r--r--client/src/app/core/rest/rest-extractor.service.ts7
-rw-r--r--client/src/app/core/rest/rest-table.ts9
-rw-r--r--client/src/app/core/rest/rest.service.ts6
-rw-r--r--client/src/app/core/routing/custom-reuse-strategy.ts7
-rw-r--r--client/src/app/core/routing/redirect.service.ts23
-rw-r--r--client/src/app/core/routing/scroll.service.ts9
-rw-r--r--client/src/app/core/server/server.service.ts3
-rw-r--r--client/src/app/core/theme/theme.service.ts11
-rw-r--r--client/src/app/core/users/user-local-storage.service.ts7
-rw-r--r--client/src/app/header/search-typeahead.component.ts3
-rw-r--r--client/src/app/helpers/i18n-utils.ts7
-rw-r--r--client/src/app/menu/menu.component.ts6
-rw-r--r--client/src/app/modal/account-setup-warning-modal.component.ts3
-rw-r--r--client/src/app/modal/admin-welcome-modal.component.ts3
-rw-r--r--client/src/app/modal/custom-modal.component.ts5
-rw-r--r--client/src/app/modal/instance-config-warning-modal.component.ts3
-rw-r--r--client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts7
-rw-r--r--client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts3
-rw-r--r--client/src/app/shared/shared-custom-markup/custom-markup.service.ts5
-rw-r--r--client/src/app/shared/shared-forms/advanced-input-filter.component.ts6
-rw-r--r--client/src/app/shared/shared-main/angular/defer-loading.directive.ts4
-rw-r--r--client/src/app/shared/shared-main/misc/list-overflow.component.ts6
-rw-r--r--client/src/app/shared/shared-main/users/user-notification.model.ts3
-rw-r--r--client/src/app/shared/shared-search/find-in-bulk.service.ts14
-rw-r--r--client/src/app/shared/shared-user-subscription/remote-subscribe.component.ts3
-rw-r--r--client/src/app/shared/shared-user-subscription/user-subscription.service.ts8
-rw-r--r--client/src/app/shared/shared-video-miniature/video-download.component.ts5
-rw-r--r--client/src/app/shared/shared-video-miniature/video-filters-header.component.ts6
-rw-r--r--client/src/app/shared/shared-video-miniature/videos-list.component.ts11
-rw-r--r--client/src/app/shared/shared-video-miniature/videos-selection.component.ts3
-rw-r--r--client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts10
-rw-r--r--client/src/app/shared/shared-video-playlist/video-playlist.service.ts8
52 files changed, 177 insertions, 142 deletions
diff --git a/client/src/app/+admin/overview/users/user-list/user-list.component.ts b/client/src/app/+admin/overview/users/user-list/user-list.component.ts
index 3e1a5f6b8..99987fdff 100644
--- a/client/src/app/+admin/overview/users/user-list/user-list.component.ts
+++ b/client/src/app/+admin/overview/users/user-list/user-list.component.ts
@@ -2,11 +2,12 @@ import { SortMeta } from 'primeng/api'
2import { Component, OnInit, ViewChild } from '@angular/core' 2import { Component, OnInit, ViewChild } from '@angular/core'
3import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
4import { AuthService, ConfirmService, LocalStorageService, Notifier, RestPagination, RestTable, ServerService } from '@app/core' 4import { AuthService, ConfirmService, LocalStorageService, Notifier, RestPagination, RestTable, ServerService } from '@app/core'
5import { prepareIcu, getAPIHost } from '@app/helpers' 5import { getAPIHost, prepareIcu } from '@app/helpers'
6import { AdvancedInputFilter } from '@app/shared/shared-forms' 6import { AdvancedInputFilter } from '@app/shared/shared-forms'
7import { Actor, DropdownAction } from '@app/shared/shared-main' 7import { Actor, DropdownAction } from '@app/shared/shared-main'
8import { AccountMutedStatus, BlocklistService, UserBanModalComponent, UserModerationDisplayType } from '@app/shared/shared-moderation' 8import { AccountMutedStatus, BlocklistService, UserBanModalComponent, UserModerationDisplayType } from '@app/shared/shared-moderation'
9import { UserAdminService } from '@app/shared/shared-users' 9import { UserAdminService } from '@app/shared/shared-users'
10import { logger } from '@root-helpers/logger'
10import { User, UserRole } from '@shared/models' 11import { User, UserRole } from '@shared/models'
11 12
12type UserForList = User & { 13type UserForList = User & {
@@ -149,7 +150,7 @@ export class UserListComponent extends RestTable implements OnInit {
149 this.selectedColumns = JSON.parse(result) 150 this.selectedColumns = JSON.parse(result)
150 return 151 return
151 } catch (err) { 152 } catch (err) {
152 console.error('Cannot load selected columns.', err) 153 logger.error('Cannot load selected columns.', err)
153 } 154 }
154 } 155 }
155 156
diff --git a/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts b/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts
index d39c2ea1c..b02c054a2 100644
--- a/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts
+++ b/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts
@@ -4,6 +4,7 @@ import { Component, OnInit } from '@angular/core'
4import { ActivatedRoute, Router } from '@angular/router' 4import { ActivatedRoute, Router } from '@angular/router'
5import { PluginApiService } from '@app/+admin/plugins/shared/plugin-api.service' 5import { PluginApiService } from '@app/+admin/plugins/shared/plugin-api.service'
6import { ComponentPagination, ConfirmService, hasMoreItems, Notifier, PluginService } from '@app/core' 6import { ComponentPagination, ConfirmService, hasMoreItems, Notifier, PluginService } from '@app/core'
7import { logger } from '@root-helpers/logger'
7import { PeerTubePluginIndex, PluginType } from '@shared/models' 8import { PeerTubePluginIndex, PluginType } from '@shared/models'
8 9
9@Component({ 10@Component({
@@ -94,7 +95,7 @@ export class PluginSearchComponent implements OnInit {
94 }, 95 },
95 96
96 error: err => { 97 error: err => {
97 console.error(err) 98 logger.error(err)
98 99
99 const message = $localize`The plugin index is not available. Please retry later.` 100 const message = $localize`The plugin index is not available. Please retry later.`
100 this.notifier.error(message) 101 this.notifier.error(message)
diff --git a/client/src/app/+admin/system/logs/log-row.model.ts b/client/src/app/+admin/system/logs/log-row.model.ts
index 615778210..e83c7b064 100644
--- a/client/src/app/+admin/system/logs/log-row.model.ts
+++ b/client/src/app/+admin/system/logs/log-row.model.ts
@@ -1,10 +1,11 @@
1import { LogLevel } from '@shared/models'
2import omit from 'lodash-es/omit' 1import omit from 'lodash-es/omit'
2import { logger } from '@root-helpers/logger'
3import { ServerLogLevel } from '@shared/models'
3 4
4export class LogRow { 5export class LogRow {
5 date: Date 6 date: Date
6 localeDate: string 7 localeDate: string
7 level: LogLevel 8 level: ServerLogLevel
8 message: string 9 message: string
9 meta: string 10 meta: string
10 11
@@ -33,7 +34,7 @@ export class LogRow {
33 this.meta = JSON.stringify(message, null, 2) 34 this.meta = JSON.stringify(message, null, 2)
34 this.message = '' 35 this.message = ''
35 } catch (err) { 36 } catch (err) {
36 console.error('Cannot parse audit message.', err) 37 logger.error('Cannot parse audit message.', err)
37 } 38 }
38 } 39 }
39 } 40 }
diff --git a/client/src/app/+admin/system/logs/logs.component.ts b/client/src/app/+admin/system/logs/logs.component.ts
index 06237522a..939e710d7 100644
--- a/client/src/app/+admin/system/logs/logs.component.ts
+++ b/client/src/app/+admin/system/logs/logs.component.ts
@@ -1,6 +1,6 @@
1import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' 1import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'
2import { LocalStorageService, Notifier } from '@app/core' 2import { LocalStorageService, Notifier } from '@app/core'
3import { LogLevel } from '@shared/models' 3import { ServerLogLevel } from '@shared/models'
4import { LogRow } from './log-row.model' 4import { LogRow } from './log-row.model'
5import { LogsService } from './logs.service' 5import { LogsService } from './logs.service'
6 6
@@ -17,11 +17,11 @@ export class LogsComponent implements OnInit {
17 17
18 logs: LogRow[] = [] 18 logs: LogRow[] = []
19 timeChoices: { id: string, label: string, dateFormat: string }[] = [] 19 timeChoices: { id: string, label: string, dateFormat: string }[] = []
20 levelChoices: { id: LogLevel, label: string }[] = [] 20 levelChoices: { id: ServerLogLevel, label: string }[] = []
21 logTypeChoices: { id: 'audit' | 'standard', label: string }[] = [] 21 logTypeChoices: { id: 'audit' | 'standard', label: string }[] = []
22 22
23 startDate: string 23 startDate: string
24 level: LogLevel 24 level: ServerLogLevel
25 logType: 'audit' | 'standard' 25 logType: 'audit' | 'standard'
26 tagsOneOf: string[] = [] 26 tagsOneOf: string[] = []
27 27
diff --git a/client/src/app/+admin/system/logs/logs.service.ts b/client/src/app/+admin/system/logs/logs.service.ts
index ea7e08b9b..933a074a8 100644
--- a/client/src/app/+admin/system/logs/logs.service.ts
+++ b/client/src/app/+admin/system/logs/logs.service.ts
@@ -3,7 +3,7 @@ import { catchError, map } from 'rxjs/operators'
3import { HttpClient, HttpParams } from '@angular/common/http' 3import { HttpClient, HttpParams } from '@angular/common/http'
4import { Injectable } from '@angular/core' 4import { Injectable } from '@angular/core'
5import { RestExtractor, RestService } from '@app/core' 5import { RestExtractor, RestService } from '@app/core'
6import { LogLevel } from '@shared/models' 6import { ServerLogLevel } from '@shared/models'
7import { environment } from '../../../../environments/environment' 7import { environment } from '../../../../environments/environment'
8import { LogRow } from './log-row.model' 8import { LogRow } from './log-row.model'
9 9
@@ -22,7 +22,7 @@ export class LogsService {
22 isAuditLog: boolean 22 isAuditLog: boolean
23 startDate: string 23 startDate: string
24 tagsOneOf?: string[] 24 tagsOneOf?: string[]
25 level?: LogLevel 25 level?: ServerLogLevel
26 endDate?: string 26 endDate?: string
27 }): Observable<any[]> { 27 }): Observable<any[]> {
28 const { isAuditLog, startDate, endDate, tagsOneOf } = options 28 const { isAuditLog, startDate, endDate, tagsOneOf } = options
diff --git a/client/src/app/+plugin-pages/plugin-pages.component.ts b/client/src/app/+plugin-pages/plugin-pages.component.ts
index 973e4d021..9fe4b413e 100644
--- a/client/src/app/+plugin-pages/plugin-pages.component.ts
+++ b/client/src/app/+plugin-pages/plugin-pages.component.ts
@@ -1,6 +1,7 @@
1import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core' 1import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 2import { ActivatedRoute, Router } from '@angular/router'
3import { PluginService } from '@app/core' 3import { PluginService } from '@app/core'
4import { logger } from '@root-helpers/logger'
4 5
5@Component({ 6@Component({
6 templateUrl: './plugin-pages.component.html' 7 templateUrl: './plugin-pages.component.html'
@@ -26,7 +27,7 @@ export class PluginPagesComponent implements AfterViewInit {
26 27
27 const registered = this.pluginService.getRegisteredClientRoute(path) 28 const registered = this.pluginService.getRegisteredClientRoute(path)
28 if (!registered) { 29 if (!registered) {
29 console.log('Could not find registered route %s.', path, this.pluginService.getAllRegisteredClientRoutes()) 30 logger.info(`Could not find registered route ${path}`, this.pluginService.getAllRegisteredClientRoutes())
30 31
31 return this.router.navigate([ '/404' ], { skipLocationChange: true }) 32 return this.router.navigate([ '/404' ], { skipLocationChange: true })
32 } 33 }
diff --git a/client/src/app/+search/shared/abstract-lazy-load.resolver.ts b/client/src/app/+search/shared/abstract-lazy-load.resolver.ts
index b18a5b64d..7551d977d 100644
--- a/client/src/app/+search/shared/abstract-lazy-load.resolver.ts
+++ b/client/src/app/+search/shared/abstract-lazy-load.resolver.ts
@@ -1,6 +1,7 @@
1import { Observable } from 'rxjs' 1import { Observable } from 'rxjs'
2import { map } from 'rxjs/operators' 2import { map } from 'rxjs/operators'
3import { ActivatedRouteSnapshot, Resolve, Router } from '@angular/router' 3import { ActivatedRouteSnapshot, Resolve, Router } from '@angular/router'
4import { logger } from '@root-helpers/logger'
4import { ResultList } from '@shared/models' 5import { ResultList } from '@shared/models'
5 6
6export abstract class AbstractLazyLoadResolver <T> implements Resolve<any> { 7export abstract class AbstractLazyLoadResolver <T> implements Resolve<any> {
@@ -10,7 +11,7 @@ export abstract class AbstractLazyLoadResolver <T> implements Resolve<any> {
10 const url = route.params.url 11 const url = route.params.url
11 12
12 if (!url) { 13 if (!url) {
13 console.error('Could not find url param.', { params: route.params }) 14 logger.error('Could not find url param.', { params: route.params })
14 return this.router.navigateByUrl('/404') 15 return this.router.navigateByUrl('/404')
15 } 16 }
16 17
@@ -18,7 +19,7 @@ export abstract class AbstractLazyLoadResolver <T> implements Resolve<any> {
18 .pipe( 19 .pipe(
19 map(result => { 20 map(result => {
20 if (result.data.length !== 1) { 21 if (result.data.length !== 1) {
21 console.error('Cannot find result for this URL') 22 logger.error('Cannot find result for this URL')
22 return this.router.navigateByUrl('/404') 23 return this.router.navigateByUrl('/404')
23 } 24 }
24 25
diff --git a/client/src/app/+video-studio/edit/video-studio-edit.component.ts b/client/src/app/+video-studio/edit/video-studio-edit.component.ts
index 392b65767..bf91c237a 100644
--- a/client/src/app/+video-studio/edit/video-studio-edit.component.ts
+++ b/client/src/app/+video-studio/edit/video-studio-edit.component.ts
@@ -4,6 +4,7 @@ import { ConfirmService, Notifier, ServerService } from '@app/core'
4import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' 4import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
5import { VideoDetails } from '@app/shared/shared-main' 5import { VideoDetails } from '@app/shared/shared-main'
6import { LoadingBarService } from '@ngx-loading-bar/core' 6import { LoadingBarService } from '@ngx-loading-bar/core'
7import { logger } from '@root-helpers/logger'
7import { secondsToTime } from '@shared/core-utils' 8import { secondsToTime } from '@shared/core-utils'
8import { VideoStudioTask, VideoStudioTaskCut } from '@shared/models' 9import { VideoStudioTask, VideoStudioTaskCut } from '@shared/models'
9import { VideoStudioService } from '../shared' 10import { VideoStudioService } from '../shared'
@@ -97,7 +98,7 @@ export class VideoStudioEditComponent extends FormReactive implements OnInit {
97 this.loadingBar.useRef().complete() 98 this.loadingBar.useRef().complete()
98 this.isRunningEdition = false 99 this.isRunningEdition = false
99 this.notifier.error(err.message) 100 this.notifier.error(err.message)
100 console.error(err) 101 logger.error(err)
101 } 102 }
102 }) 103 })
103 } 104 }
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
38import { VideoCaptionEditModalComponent } from './video-caption-edit-modal/video-caption-edit-modal.component' 38import { VideoCaptionEditModalComponent } from './video-caption-edit-modal/video-caption-edit-modal.component'
39import { VideoEditType } from './video-edit.type' 39import { VideoEditType } from './video-edit.type'
40import { VideoSource } from '@shared/models/videos/video-source' 40import { VideoSource } from '@shared/models/videos/video-source'
41import { logger } from '@root-helpers/logger'
41 42
42type VideoLanguages = VideoConstant<string> & { group?: string } 43type VideoLanguages = VideoConstant<string> & { group?: string }
43type PluginField = { 44type 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'
7import { Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' 7import { Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main'
8import { LiveVideoService } from '@app/shared/shared-video-live' 8import { LiveVideoService } from '@app/shared/shared-video-live'
9import { LoadingBarService } from '@ngx-loading-bar/core' 9import { LoadingBarService } from '@ngx-loading-bar/core'
10import { logger } from '@root-helpers/logger'
10import { LiveVideo, LiveVideoCreate, LiveVideoLatencyMode, LiveVideoUpdate, PeerTubeProblemDocument, ServerErrorCode } from '@shared/models' 11import { LiveVideo, LiveVideoCreate, LiveVideoLatencyMode, LiveVideoUpdate, PeerTubeProblemDocument, ServerErrorCode } from '@shared/models'
11import { VideoSend } from './video-send' 12import { 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'
6import { FormValidatorService } from '@app/shared/shared-forms' 6import { FormValidatorService } from '@app/shared/shared-forms'
7import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main' 7import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main'
8import { LoadingBarService } from '@ngx-loading-bar/core' 8import { LoadingBarService } from '@ngx-loading-bar/core'
9import { logger } from '@root-helpers/logger'
9import { PeerTubeProblemDocument, ServerErrorCode, VideoUpdate } from '@shared/models' 10import { PeerTubeProblemDocument, ServerErrorCode, VideoUpdate } from '@shared/models'
10import { hydrateFormFromVideo } from '../shared/video-edit-utils' 11import { hydrateFormFromVideo } from '../shared/video-edit-utils'
11import { VideoSend } from './video-send' 12import { 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'
7import { FormValidatorService } from '@app/shared/shared-forms' 7import { FormValidatorService } from '@app/shared/shared-forms'
8import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main' 8import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main'
9import { LoadingBarService } from '@ngx-loading-bar/core' 9import { LoadingBarService } from '@ngx-loading-bar/core'
10import { logger } from '@root-helpers/logger'
10import { VideoUpdate } from '@shared/models' 11import { VideoUpdate } from '@shared/models'
11import { hydrateFormFromVideo } from '../shared/video-edit-utils' 12import { hydrateFormFromVideo } from '../shared/video-edit-utils'
12import { VideoSend } from './video-send' 13import { 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 @@
1import { truncate } from 'lodash-es' 1import { truncate } from 'lodash-es'
2import { UploadState, UploadxOptions, UploadxService } from 'ngx-uploadx' 2import { UploadState, UploadxOptions, UploadxService } from 'ngx-uploadx'
3import { isIOS } from '@root-helpers/web-browser'
4import { HttpErrorResponse, HttpEventType, HttpHeaders } from '@angular/common/http' 3import { HttpErrorResponse, HttpEventType, HttpHeaders } from '@angular/common/http'
5import { AfterViewInit, Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' 4import { AfterViewInit, Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core'
6import { ActivatedRoute, Router } from '@angular/router' 5import { ActivatedRoute, Router } from '@angular/router'
@@ -9,6 +8,8 @@ import { genericUploadErrorHandler, scrollToTop } from '@app/helpers'
9import { FormValidatorService } from '@app/shared/shared-forms' 8import { FormValidatorService } from '@app/shared/shared-forms'
10import { BytesPipe, Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' 9import { BytesPipe, Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main'
11import { LoadingBarService } from '@ngx-loading-bar/core' 10import { LoadingBarService } from '@ngx-loading-bar/core'
11import { logger } from '@root-helpers/logger'
12import { isIOS } from '@root-helpers/web-browser'
12import { HttpStatusCode, VideoCreateResult } from '@shared/models' 13import { HttpStatusCode, VideoCreateResult } from '@shared/models'
13import { UploaderXFormData } from './uploaderx-form-data' 14import { UploaderXFormData } from './uploaderx-form-data'
14import { VideoSend } from './video-send' 15import { 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'
8import { Video, VideoCaptionEdit, VideoCaptionService, VideoDetails, VideoEdit, VideoService } from '@app/shared/shared-main' 8import { Video, VideoCaptionEdit, VideoCaptionService, VideoDetails, VideoEdit, VideoService } from '@app/shared/shared-main'
9import { LiveVideoService } from '@app/shared/shared-video-live' 9import { LiveVideoService } from '@app/shared/shared-video-live'
10import { LoadingBarService } from '@ngx-loading-bar/core' 10import { LoadingBarService } from '@ngx-loading-bar/core'
11import { logger } from '@root-helpers/logger'
11import { LiveVideo, LiveVideoUpdate, VideoPrivacy } from '@shared/models' 12import { LiveVideo, LiveVideoUpdate, VideoPrivacy } from '@shared/models'
12import { hydrateFormFromVideo } from './shared/video-edit-utils'
13import { VideoSource } from '@shared/models/videos/video-source' 13import { VideoSource } from '@shared/models/videos/video-source'
14import { 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 @@
1import { Component, EventEmitter, Input, OnChanges, Output } from '@angular/core' 1import { Component, EventEmitter, Input, OnChanges, Output } from '@angular/core'
2import { MarkdownService, Notifier } from '@app/core' 2import { MarkdownService, Notifier } from '@app/core'
3import { VideoDetails, VideoService } from '@app/shared/shared-main' 3import { VideoDetails, VideoService } from '@app/shared/shared-main'
4import { 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
24import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription' 24import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription'
25import { LiveVideoService } from '@app/shared/shared-video-live' 25import { LiveVideoService } from '@app/shared/shared-video-live'
26import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' 26import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist'
27import { logger } from '@root-helpers/logger'
27import { isP2PEnabled } from '@root-helpers/video' 28import { isP2PEnabled } from '@root-helpers/video'
28import { timeToInt } from '@shared/core-utils' 29import { timeToInt } from '@shared/core-utils'
29import { 30import {
@@ -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 }
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index 8fdab0c40..a2ad4806c 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -1,5 +1,5 @@
1import { Hotkey, HotkeysService } from 'angular2-hotkeys' 1import { Hotkey, HotkeysService } from 'angular2-hotkeys'
2import { forkJoin, delay } from 'rxjs' 2import { delay, forkJoin } from 'rxjs'
3import { filter, first, map } from 'rxjs/operators' 3import { filter, first, map } from 'rxjs/operators'
4import { DOCUMENT, getLocaleDirection, PlatformLocation } from '@angular/common' 4import { DOCUMENT, getLocaleDirection, PlatformLocation } from '@angular/common'
5import { AfterViewInit, Component, Inject, LOCALE_ID, OnInit, ViewChild } from '@angular/core' 5import { AfterViewInit, Component, Inject, LOCALE_ID, OnInit, ViewChild } from '@angular/core'
@@ -20,18 +20,19 @@ import {
20import { HooksService } from '@app/core/plugins/hooks.service' 20import { HooksService } from '@app/core/plugins/hooks.service'
21import { PluginService } from '@app/core/plugins/plugin.service' 21import { PluginService } from '@app/core/plugins/plugin.service'
22import { AccountSetupWarningModalComponent } from '@app/modal/account-setup-warning-modal.component' 22import { AccountSetupWarningModalComponent } from '@app/modal/account-setup-warning-modal.component'
23import { AdminWelcomeModalComponent } from '@app/modal/admin-welcome-modal.component'
23import { CustomModalComponent } from '@app/modal/custom-modal.component' 24import { CustomModalComponent } from '@app/modal/custom-modal.component'
24import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component' 25import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component'
25import { AdminWelcomeModalComponent } from '@app/modal/admin-welcome-modal.component'
26import { NgbConfig, NgbModal } from '@ng-bootstrap/ng-bootstrap' 26import { NgbConfig, NgbModal } from '@ng-bootstrap/ng-bootstrap'
27import { LoadingBarService } from '@ngx-loading-bar/core' 27import { LoadingBarService } from '@ngx-loading-bar/core'
28import { logger } from '@root-helpers/logger'
28import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' 29import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
29import { getShortLocale } from '@shared/core-utils/i18n' 30import { getShortLocale } from '@shared/core-utils/i18n'
30import { BroadcastMessageLevel, HTMLServerConfig, UserRole } from '@shared/models' 31import { BroadcastMessageLevel, HTMLServerConfig, UserRole } from '@shared/models'
31import { MenuService } from './core/menu/menu.service' 32import { MenuService } from './core/menu/menu.service'
32import { POP_STATE_MODAL_DISMISS } from './helpers' 33import { POP_STATE_MODAL_DISMISS } from './helpers'
33import { InstanceService } from './shared/shared-instance'
34import { GlobalIconName } from './shared/shared-icons' 34import { GlobalIconName } from './shared/shared-icons'
35import { InstanceService } from './shared/shared-instance'
35 36
36@Component({ 37@Component({
37 selector: 'my-app', 38 selector: 'my-app',
@@ -221,7 +222,7 @@ export class AppComponent implements OnInit, AfterViewInit {
221 /* eslint-disable no-eval */ 222 /* eslint-disable no-eval */
222 eval(this.serverConfig.instance.customizations.javascript) 223 eval(this.serverConfig.instance.customizations.javascript)
223 } catch (err) { 224 } catch (err) {
224 console.error('Cannot eval custom JavaScript.', err) 225 logger.error('Cannot eval custom JavaScript.', err)
225 } 226 }
226 } 227 }
227 } 228 }
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts
index 2ac88c185..ece6bc5d1 100644
--- a/client/src/app/core/auth/auth.service.ts
+++ b/client/src/app/core/auth/auth.service.ts
@@ -5,7 +5,7 @@ import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'
5import { Injectable } from '@angular/core' 5import { Injectable } from '@angular/core'
6import { Router } from '@angular/router' 6import { Router } from '@angular/router'
7import { Notifier } from '@app/core/notification/notifier.service' 7import { Notifier } from '@app/core/notification/notifier.service'
8import { objectToUrlEncoded, peertubeLocalStorage, UserTokens } from '@root-helpers/index' 8import { logger, objectToUrlEncoded, peertubeLocalStorage, UserTokens } from '@root-helpers/index'
9import { HttpStatusCode, MyUser as UserServerModel, OAuthClientLocal, User, UserLogin, UserRefreshToken } from '@shared/models' 9import { HttpStatusCode, MyUser as UserServerModel, OAuthClientLocal, User, UserLogin, UserRefreshToken } from '@shared/models'
10import { environment } from '../../../environments/environment' 10import { environment } from '../../../environments/environment'
11import { RestExtractor } from '../rest/rest-extractor.service' 11import { RestExtractor } from '../rest/rest-extractor.service'
@@ -90,7 +90,7 @@ export class AuthService {
90 peertubeLocalStorage.setItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_ID, this.clientId) 90 peertubeLocalStorage.setItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_ID, this.clientId)
91 peertubeLocalStorage.setItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_SECRET, this.clientSecret) 91 peertubeLocalStorage.setItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_SECRET, this.clientSecret)
92 92
93 console.log('Client credentials loaded.') 93 logger.info('Client credentials loaded.')
94 }, 94 },
95 95
96 error: err => { 96 error: err => {
@@ -177,7 +177,7 @@ Ensure you have correctly configured PeerTube (config/ directory), in particular
177 } 177 }
178 }, 178 },
179 179
180 error: err => console.error(err) 180 error: err => logger.error(err)
181 }) 181 })
182 182
183 this.user = null 183 this.user = null
@@ -190,7 +190,7 @@ Ensure you have correctly configured PeerTube (config/ directory), in particular
190 refreshAccessToken () { 190 refreshAccessToken () {
191 if (this.refreshingTokenObservable) return this.refreshingTokenObservable 191 if (this.refreshingTokenObservable) return this.refreshingTokenObservable
192 192
193 console.log('Refreshing token...') 193 logger.info('Refreshing token...')
194 194
195 const refreshToken = this.getRefreshToken() 195 const refreshToken = this.getRefreshToken()
196 196
@@ -212,8 +212,8 @@ Ensure you have correctly configured PeerTube (config/ directory), in particular
212 catchError(err => { 212 catchError(err => {
213 this.refreshingTokenObservable = null 213 this.refreshingTokenObservable = null
214 214
215 console.error(err) 215 logger.error(err)
216 console.log('Cannot refresh token -> logout...') 216 logger.info('Cannot refresh token -> logout...')
217 this.logout() 217 this.logout()
218 this.router.navigate([ '/login' ]) 218 this.router.navigate([ '/login' ])
219 219
diff --git a/client/src/app/core/notification/notifier.service.ts b/client/src/app/core/notification/notifier.service.ts
index 165bb0c76..15af5c1b6 100644
--- a/client/src/app/core/notification/notifier.service.ts
+++ b/client/src/app/core/notification/notifier.service.ts
@@ -1,5 +1,6 @@
1import { MessageService } from 'primeng/api' 1import { MessageService } from 'primeng/api'
2import { Injectable } from '@angular/core' 2import { Injectable } from '@angular/core'
3import { logger } from '@root-helpers/logger'
3 4
4@Injectable() 5@Injectable()
5export class Notifier { 6export class Notifier {
@@ -10,21 +11,21 @@ export class Notifier {
10 info (text: string, title?: string, timeout?: number, sticky?: boolean) { 11 info (text: string, title?: string, timeout?: number, sticky?: boolean) {
11 if (!title) title = $localize`Info` 12 if (!title) title = $localize`Info`
12 13
13 console.info(`${title}: ${text}`) 14 logger.info(`${title}: ${text}`)
14 return this.notify('info', text, title, timeout, sticky) 15 return this.notify('info', text, title, timeout, sticky)
15 } 16 }
16 17
17 error (text: string, title?: string, timeout?: number, sticky?: boolean) { 18 error (text: string, title?: string, timeout?: number, sticky?: boolean) {
18 if (!title) title = $localize`Error` 19 if (!title) title = $localize`Error`
19 20
20 console.error(`${title}: ${text}`) 21 logger.error(`${title}: ${text}`)
21 return this.notify('error', text, title, timeout, sticky) 22 return this.notify('error', text, title, timeout, sticky)
22 } 23 }
23 24
24 success (text: string, title?: string, timeout?: number, sticky?: boolean) { 25 success (text: string, title?: string, timeout?: number, sticky?: boolean) {
25 if (!title) title = $localize`Success` 26 if (!title) title = $localize`Success`
26 27
27 console.log(`${title}: ${text}`) 28 logger.info(`${title}: ${text}`)
28 return this.notify('success', text, title, timeout, sticky) 29 return this.notify('success', text, title, timeout, sticky)
29 } 30 }
30 31
diff --git a/client/src/app/core/plugins/hooks.service.ts b/client/src/app/core/plugins/hooks.service.ts
index 062083fd1..7fd56d92e 100644
--- a/client/src/app/core/plugins/hooks.service.ts
+++ b/client/src/app/core/plugins/hooks.service.ts
@@ -2,6 +2,7 @@ import { from, Observable } from 'rxjs'
2import { mergeMap, switchMap } from 'rxjs/operators' 2import { mergeMap, switchMap } from 'rxjs/operators'
3import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
4import { PluginService } from '@app/core/plugins/plugin.service' 4import { PluginService } from '@app/core/plugins/plugin.service'
5import { logger } from '@root-helpers/logger'
5import { ClientActionHookName, ClientFilterHookName, PluginClientScope } from '@shared/models' 6import { ClientActionHookName, ClientFilterHookName, PluginClientScope } from '@shared/models'
6import { AuthService, AuthStatus } from '../auth' 7import { AuthService, AuthStatus } from '../auth'
7 8
@@ -50,7 +51,7 @@ export class HooksService {
50 runAction<T, U extends ClientActionHookName> (hookName: U, scope: PluginClientScope, params?: T) { 51 runAction<T, U extends ClientActionHookName> (hookName: U, scope: PluginClientScope, params?: T) {
51 this.pluginService.ensurePluginsAreLoaded(scope) 52 this.pluginService.ensurePluginsAreLoaded(scope)
52 .then(() => this.pluginService.runHook(hookName, undefined, params)) 53 .then(() => this.pluginService.runHook(hookName, undefined, params))
53 .catch((err: any) => console.error('Fatal hook error.', { err })) 54 .catch((err: any) => logger.error('Fatal hook error.', err))
54 } 55 }
55 56
56 async wrapObject<T, U extends ClientFilterHookName> (result: T, scope: PluginClientScope, hookName: U) { 57 async wrapObject<T, U extends ClientFilterHookName> (result: T, scope: PluginClientScope, hookName: U) {
diff --git a/client/src/app/core/rest/rest-extractor.service.ts b/client/src/app/core/rest/rest-extractor.service.ts
index 86c7484a5..8a2974563 100644
--- a/client/src/app/core/rest/rest-extractor.service.ts
+++ b/client/src/app/core/rest/rest-extractor.service.ts
@@ -3,6 +3,7 @@ import { Injectable } from '@angular/core'
3import { Router } from '@angular/router' 3import { Router } from '@angular/router'
4import { dateToHuman } from '@app/helpers' 4import { dateToHuman } from '@app/helpers'
5import { HttpStatusCode, ResultList } from '@shared/models' 5import { HttpStatusCode, ResultList } from '@shared/models'
6import { logger } from '@root-helpers/logger'
6 7
7@Injectable() 8@Injectable()
8export class RestExtractor { 9export class RestExtractor {
@@ -64,7 +65,7 @@ export class RestExtractor {
64 if (err.error instanceof Error) { 65 if (err.error instanceof Error) {
65 // A client-side or network error occurred. Handle it accordingly. 66 // A client-side or network error occurred. Handle it accordingly.
66 const errorMessage = err.error.detail || err.error.title 67 const errorMessage = err.error.detail || err.error.title
67 console.error('An error occurred:', errorMessage) 68 logger.error('An error occurred:', errorMessage)
68 69
69 return errorMessage 70 return errorMessage
70 } 71 }
@@ -75,12 +76,12 @@ export class RestExtractor {
75 76
76 if (err.status !== undefined) { 77 if (err.status !== undefined) {
77 const errorMessage = this.buildServerErrorMessage(err) 78 const errorMessage = this.buildServerErrorMessage(err)
78 console.error(`Backend returned code ${err.status}, errorMessage is: ${errorMessage}`) 79 logger.error(`Backend returned code ${err.status}, errorMessage is: ${errorMessage}`)
79 80
80 return errorMessage 81 return errorMessage
81 } 82 }
82 83
83 console.error(err) 84 logger.error(err)
84 return err 85 return err
85 } 86 }
86 87
diff --git a/client/src/app/core/rest/rest-table.ts b/client/src/app/core/rest/rest-table.ts
index cb5bd0b89..ec5646b5d 100644
--- a/client/src/app/core/rest/rest-table.ts
+++ b/client/src/app/core/rest/rest-table.ts
@@ -1,10 +1,11 @@
1import * as debug from 'debug' 1import debug from 'debug'
2import { LazyLoadEvent, SortMeta } from 'primeng/api' 2import { LazyLoadEvent, SortMeta } from 'primeng/api'
3import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
4import { logger } from '@root-helpers/logger'
4import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' 5import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
5import { RestPagination } from './rest-pagination' 6import { RestPagination } from './rest-pagination'
6 7
7const logger = debug('peertube:tables:RestTable') 8const debugLogger = debug('peertube:tables:RestTable')
8 9
9export abstract class RestTable { 10export abstract class RestTable {
10 11
@@ -34,7 +35,7 @@ export abstract class RestTable {
34 try { 35 try {
35 this.sort = JSON.parse(result) 36 this.sort = JSON.parse(result)
36 } catch (err) { 37 } catch (err) {
37 console.error('Cannot load sort of local storage key ' + this.getSortLocalStorageKey(), err) 38 logger.error('Cannot load sort of local storage key ' + this.getSortLocalStorageKey(), err)
38 } 39 }
39 } 40 }
40 } 41 }
@@ -44,7 +45,7 @@ export abstract class RestTable {
44 } 45 }
45 46
46 loadLazy (event: LazyLoadEvent) { 47 loadLazy (event: LazyLoadEvent) {
47 logger('Load lazy %o.', event) 48 debugLogger('Load lazy %o.', event)
48 49
49 this.sort = { 50 this.sort = {
50 order: event.sortOrder, 51 order: event.sortOrder,
diff --git a/client/src/app/core/rest/rest.service.ts b/client/src/app/core/rest/rest.service.ts
index fc729f0f6..d8b5ffb18 100644
--- a/client/src/app/core/rest/rest.service.ts
+++ b/client/src/app/core/rest/rest.service.ts
@@ -5,7 +5,7 @@ import { Injectable } from '@angular/core'
5import { ComponentPaginationLight } from './component-pagination.model' 5import { ComponentPaginationLight } from './component-pagination.model'
6import { RestPagination } from './rest-pagination' 6import { RestPagination } from './rest-pagination'
7 7
8const logger = debug('peertube:rest') 8const debugLogger = debug('peertube:rest')
9 9
10interface QueryStringFilterPrefixes { 10interface QueryStringFilterPrefixes {
11 [key: string]: { 11 [key: string]: {
@@ -88,7 +88,7 @@ export class RestService {
88 const prefixeStrings = Object.values(prefixes) 88 const prefixeStrings = Object.values(prefixes)
89 .map(p => p.prefix) 89 .map(p => p.prefix)
90 90
91 logger(`Built tokens "${tokens.join(', ')}" for prefixes "${prefixeStrings.join(', ')}"`) 91 debugLogger(`Built tokens "${tokens.join(', ')}" for prefixes "${prefixeStrings.join(', ')}"`)
92 92
93 // Search is the querystring minus defined filters 93 // Search is the querystring minus defined filters
94 const searchTokens = tokens.filter(t => { 94 const searchTokens = tokens.filter(t => {
@@ -127,7 +127,7 @@ export class RestService {
127 127
128 const search = searchTokens.join(' ') || undefined 128 const search = searchTokens.join(' ') || undefined
129 129
130 logger('Built search: ' + search, additionalFilters) 130 debugLogger('Built search: ' + search, additionalFilters)
131 131
132 return { 132 return {
133 search, 133 search,
diff --git a/client/src/app/core/routing/custom-reuse-strategy.ts b/client/src/app/core/routing/custom-reuse-strategy.ts
index 5d3ad2e67..269b9d193 100644
--- a/client/src/app/core/routing/custom-reuse-strategy.ts
+++ b/client/src/app/core/routing/custom-reuse-strategy.ts
@@ -1,5 +1,6 @@
1import { ComponentRef, Injectable } from '@angular/core' 1import { ComponentRef, Injectable } from '@angular/core'
2import { ActivatedRouteSnapshot, DetachedRouteHandle, RouteReuseStrategy } from '@angular/router' 2import { ActivatedRouteSnapshot, DetachedRouteHandle, RouteReuseStrategy } from '@angular/router'
3import { logger } from '@root-helpers/logger'
3import { DisableForReuseHook } from './disable-for-reuse-hook' 4import { DisableForReuseHook } from './disable-for-reuse-hook'
4import { PeerTubeRouterService, RouterSetting } from './peertube-router.service' 5import { PeerTubeRouterService, RouterSetting } from './peertube-router.service'
5 6
@@ -22,7 +23,7 @@ export class CustomReuseStrategy implements RouteReuseStrategy {
22 const key = this.generateKey(route) 23 const key = this.generateKey(route)
23 this.recentlyUsed = key 24 this.recentlyUsed = key
24 25
25 console.log('Storing component %s to reuse later.', key) 26 logger.info(`Storing component ${key} to reuse later.`)
26 27
27 const componentRef = (handle as any).componentRef as ComponentRef<DisableForReuseHook> 28 const componentRef = (handle as any).componentRef as ComponentRef<DisableForReuseHook>
28 componentRef.instance.disableForReuse() 29 componentRef.instance.disableForReuse()
@@ -46,7 +47,7 @@ export class CustomReuseStrategy implements RouteReuseStrategy {
46 const key = this.generateKey(route) 47 const key = this.generateKey(route)
47 this.recentlyUsed = key 48 this.recentlyUsed = key
48 49
49 console.log('Reusing component %s.', key) 50 logger.info(`Reusing component ${key}.`)
50 51
51 const handle = this.storedRouteHandles.get(key) 52 const handle = this.storedRouteHandles.get(key)
52 if (!handle) return handle; 53 if (!handle) return handle;
@@ -66,7 +67,7 @@ export class CustomReuseStrategy implements RouteReuseStrategy {
66 this.storedRouteHandles.forEach((r, key) => { 67 this.storedRouteHandles.forEach((r, key) => {
67 if (key === this.recentlyUsed) return 68 if (key === this.recentlyUsed) return
68 69
69 console.log('Removing stored component %s.', key); 70 logger.info(`Removing stored component ${key}`);
70 71
71 (r as any).componentRef.destroy() 72 (r as any).componentRef.destroy()
72 this.storedRouteHandles.delete(key) 73 this.storedRouteHandles.delete(key)
diff --git a/client/src/app/core/routing/redirect.service.ts b/client/src/app/core/routing/redirect.service.ts
index 567fd432b..575b3b2a1 100644
--- a/client/src/app/core/routing/redirect.service.ts
+++ b/client/src/app/core/routing/redirect.service.ts
@@ -1,10 +1,11 @@
1import * as debug from 'debug' 1import * as debug from 'debug'
2import { Injectable } from '@angular/core' 2import { Injectable } from '@angular/core'
3import { NavigationCancel, NavigationEnd, Router } from '@angular/router' 3import { NavigationCancel, NavigationEnd, Router } from '@angular/router'
4import { logger } from '@root-helpers/logger'
4import { ServerService } from '../server' 5import { ServerService } from '../server'
5import { SessionStorageService } from '../wrappers/storage.service' 6import { SessionStorageService } from '../wrappers/storage.service'
6 7
7const logger = debug('peertube:router:RedirectService') 8const debugLogger = debug('peertube:router:RedirectService')
8 9
9@Injectable() 10@Injectable()
10export class RedirectService { 11export class RedirectService {
@@ -40,7 +41,7 @@ export class RedirectService {
40 this.latestSessionUrl = this.storage.getItem(RedirectService.SESSION_STORAGE_LATEST_SESSION_URL_KEY) 41 this.latestSessionUrl = this.storage.getItem(RedirectService.SESSION_STORAGE_LATEST_SESSION_URL_KEY)
41 this.storage.removeItem(RedirectService.SESSION_STORAGE_LATEST_SESSION_URL_KEY) 42 this.storage.removeItem(RedirectService.SESSION_STORAGE_LATEST_SESSION_URL_KEY)
42 43
43 logger('Loaded latest session URL %s', this.latestSessionUrl) 44 debugLogger('Loaded latest session URL %s', this.latestSessionUrl)
44 45
45 // Track previous url 46 // Track previous url
46 this.currentUrl = this.router.url 47 this.currentUrl = this.router.url
@@ -51,8 +52,8 @@ export class RedirectService {
51 this.previousUrl = this.currentUrl 52 this.previousUrl = this.currentUrl
52 this.currentUrl = event.url 53 this.currentUrl = event.url
53 54
54 logger('Previous URL is %s, current URL is %s', this.previousUrl, this.currentUrl) 55 debugLogger('Previous URL is %s, current URL is %s', this.previousUrl, this.currentUrl)
55 logger('Setting %s as latest URL in session storage.', this.currentUrl) 56 debugLogger('Setting %s as latest URL in session storage.', this.currentUrl)
56 57
57 this.storage.setItem(RedirectService.SESSION_STORAGE_LATEST_SESSION_URL_KEY, this.currentUrl) 58 this.storage.setItem(RedirectService.SESSION_STORAGE_LATEST_SESSION_URL_KEY, this.currentUrl)
58 } 59 }
@@ -84,18 +85,14 @@ export class RedirectService {
84 85
85 this.redirectingToHomepage = true 86 this.redirectingToHomepage = true
86 87
87 console.log('Redirecting to %s...', this.defaultRoute) 88 logger.info(`Redirecting to ${this.defaultRoute}...`)
88 89
89 this.router.navigateByUrl(this.defaultRoute, { skipLocationChange }) 90 this.router.navigateByUrl(this.defaultRoute, { skipLocationChange })
90 .then(() => this.redirectingToHomepage = false) 91 .then(() => this.redirectingToHomepage = false)
91 .catch(() => { 92 .catch(() => {
92 this.redirectingToHomepage = false 93 this.redirectingToHomepage = false
93 94
94 console.error( 95 logger.error(`Cannot navigate to ${this.defaultRoute}, resetting default route to ${RedirectService.INIT_DEFAULT_ROUTE}`)
95 'Cannot navigate to %s, resetting default route to %s.',
96 this.defaultRoute,
97 RedirectService.INIT_DEFAULT_ROUTE
98 )
99 96
100 this.defaultRoute = RedirectService.INIT_DEFAULT_ROUTE 97 this.defaultRoute = RedirectService.INIT_DEFAULT_ROUTE
101 return this.router.navigateByUrl(this.defaultRoute, { skipLocationChange }) 98 return this.router.navigateByUrl(this.defaultRoute, { skipLocationChange })
@@ -104,18 +101,18 @@ export class RedirectService {
104 } 101 }
105 102
106 private doRedirect (redirectUrl: string, fallbackRoute?: string) { 103 private doRedirect (redirectUrl: string, fallbackRoute?: string) {
107 logger('Redirecting on %s', redirectUrl) 104 debugLogger('Redirecting on %s', redirectUrl)
108 105
109 if (this.isValidRedirection(redirectUrl)) { 106 if (this.isValidRedirection(redirectUrl)) {
110 return this.router.navigateByUrl(redirectUrl) 107 return this.router.navigateByUrl(redirectUrl)
111 } 108 }
112 109
113 logger('%s is not a valid redirection, try fallback route %s', redirectUrl, fallbackRoute) 110 debugLogger('%s is not a valid redirection, try fallback route %s', redirectUrl, fallbackRoute)
114 if (fallbackRoute) { 111 if (fallbackRoute) {
115 return this.router.navigateByUrl(fallbackRoute) 112 return this.router.navigateByUrl(fallbackRoute)
116 } 113 }
117 114
118 logger('There was no fallback route, redirecting to homepage') 115 debugLogger('There was no fallback route, redirecting to homepage')
119 return this.redirectToHomepage() 116 return this.redirectToHomepage()
120 } 117 }
121 118
diff --git a/client/src/app/core/routing/scroll.service.ts b/client/src/app/core/routing/scroll.service.ts
index 6d37fde71..0966255b3 100644
--- a/client/src/app/core/routing/scroll.service.ts
+++ b/client/src/app/core/routing/scroll.service.ts
@@ -4,8 +4,9 @@ import { ViewportScroller } from '@angular/common'
4import { Injectable } from '@angular/core' 4import { Injectable } from '@angular/core'
5import { RouterSetting } from '../' 5import { RouterSetting } from '../'
6import { PeerTubeRouterService } from './peertube-router.service' 6import { PeerTubeRouterService } from './peertube-router.service'
7import { logger } from '@root-helpers/logger'
7 8
8const logger = debug('peertube:main:ScrollService') 9const debugLogger = debug('peertube:main:ScrollService')
9 10
10@Injectable() 11@Injectable()
11export class ScrollService { 12export class ScrollService {
@@ -57,8 +58,8 @@ export class ScrollService {
57 if (nextSearchParams.toString() !== previousSearchParams.toString()) { 58 if (nextSearchParams.toString() !== previousSearchParams.toString()) {
58 this.resetScroll = true 59 this.resetScroll = true
59 } 60 }
60 } catch (e) { 61 } catch (err) {
61 console.error('Cannot parse URL to check next scroll.', e) 62 logger.error('Cannot parse URL to check next scroll.', err)
62 this.resetScroll = true 63 this.resetScroll = true
63 } 64 }
64 }) 65 })
@@ -67,7 +68,7 @@ export class ScrollService {
67 private consumeScroll () { 68 private consumeScroll () {
68 // Handle anchors/restore position 69 // Handle anchors/restore position
69 this.peertubeRouter.getScrollEvents().subscribe(e => { 70 this.peertubeRouter.getScrollEvents().subscribe(e => {
70 logger('Will schedule scroll after router event %o.', { e, resetScroll: this.resetScroll }) 71 debugLogger('Will schedule scroll after router event %o.', { e, resetScroll: this.resetScroll })
71 72
72 // scrollToAnchor first to preserve anchor position when using history navigation 73 // scrollToAnchor first to preserve anchor position when using history navigation
73 if (e.anchor) { 74 if (e.anchor) {
diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts
index d01942139..9db455cb8 100644
--- a/client/src/app/core/server/server.service.ts
+++ b/client/src/app/core/server/server.service.ts
@@ -3,6 +3,7 @@ import { first, map, share, shareReplay, switchMap, tap } from 'rxjs/operators'
3import { HttpClient } from '@angular/common/http' 3import { HttpClient } from '@angular/common/http'
4import { Inject, Injectable, LOCALE_ID } from '@angular/core' 4import { Inject, Injectable, LOCALE_ID } from '@angular/core'
5import { getDevLocale, isOnDevLocale, sortBy } from '@app/helpers' 5import { getDevLocale, isOnDevLocale, sortBy } from '@app/helpers'
6import { logger } from '@root-helpers/logger'
6import { getCompleteLocale, isDefaultLocale, peertubeTranslate } from '@shared/core-utils/i18n' 7import { getCompleteLocale, isDefaultLocale, peertubeTranslate } from '@shared/core-utils/i18n'
7import { HTMLServerConfig, ServerConfig, ServerStats, VideoConstant } from '@shared/models' 8import { HTMLServerConfig, ServerConfig, ServerStats, VideoConstant } from '@shared/models'
8import { environment } from '../../../environments/environment' 9import { environment } from '../../../environments/environment'
@@ -43,7 +44,7 @@ export class ServerService {
43 } catch (err) { 44 } catch (err) {
44 // Expected in dev mode since we can't inject the config in the HTML 45 // Expected in dev mode since we can't inject the config in the HTML
45 if (environment.production !== false) { 46 if (environment.production !== false) {
46 console.error('Cannot load config locally. Fallback to API.') 47 logger.error('Cannot load config locally. Fallback to API.')
47 } 48 }
48 49
49 return this.getConfig() 50 return this.getConfig()
diff --git a/client/src/app/core/theme/theme.service.ts b/client/src/app/core/theme/theme.service.ts
index 40939ecb8..ead1770ba 100644
--- a/client/src/app/core/theme/theme.service.ts
+++ b/client/src/app/core/theme/theme.service.ts
@@ -1,4 +1,5 @@
1import { Injectable } from '@angular/core' 1import { Injectable } from '@angular/core'
2import { logger } from '@root-helpers/logger'
2import { capitalizeFirstLetter } from '@root-helpers/string' 3import { capitalizeFirstLetter } from '@root-helpers/string'
3import { UserLocalStorageKeys } from '@root-helpers/users' 4import { UserLocalStorageKeys } from '@root-helpers/users'
4import { HTMLServerConfig, ServerConfigTheme } from '@shared/models' 5import { HTMLServerConfig, ServerConfigTheme } from '@shared/models'
@@ -57,7 +58,7 @@ export class ThemeService {
57 private injectThemes (themes: ServerConfigTheme[], fromLocalStorage = false) { 58 private injectThemes (themes: ServerConfigTheme[], fromLocalStorage = false) {
58 this.themes = themes 59 this.themes = themes
59 60
60 console.log('Injecting %d themes.', this.themes.length) 61 logger.info(`Injecting ${this.themes.length} themes.`)
61 62
62 const head = this.getHeadElement() 63 const head = this.getHeadElement()
63 64
@@ -117,13 +118,13 @@ export class ThemeService {
117 118
118 const currentTheme = this.getCurrentTheme() 119 const currentTheme = this.getCurrentTheme()
119 120
120 console.log('Enabling %s theme.', currentTheme) 121 logger.info(`Enabling ${currentTheme} theme.`)
121 122
122 this.loadTheme(currentTheme) 123 this.loadTheme(currentTheme)
123 124
124 const theme = this.getTheme(currentTheme) 125 const theme = this.getTheme(currentTheme)
125 if (theme) { 126 if (theme) {
126 console.log('Adding scripts of theme %s.', currentTheme) 127 logger.info(`Adding scripts of theme ${currentTheme}`)
127 128
128 this.pluginService.addPlugin(theme, true) 129 this.pluginService.addPlugin(theme, true)
129 130
@@ -165,7 +166,7 @@ export class ThemeService {
165 this.injectThemes([ lastActiveTheme ], true) 166 this.injectThemes([ lastActiveTheme ], true)
166 this.updateCurrentTheme() 167 this.updateCurrentTheme()
167 } catch (err) { 168 } catch (err) {
168 console.error('Cannot parse last active theme.', err) 169 logger.error('Cannot parse last active theme.', err)
169 return 170 return
170 } 171 }
171 } 172 }
@@ -173,7 +174,7 @@ export class ThemeService {
173 private removeThemePlugins (themeName: string) { 174 private removeThemePlugins (themeName: string) {
174 const oldTheme = this.getTheme(themeName) 175 const oldTheme = this.getTheme(themeName)
175 if (oldTheme) { 176 if (oldTheme) {
176 console.log('Removing scripts of old theme %s.', themeName) 177 logger.info(`Removing scripts of old theme ${themeName}.`)
177 this.pluginService.removePlugin(oldTheme) 178 this.pluginService.removePlugin(oldTheme)
178 } 179 }
179 } 180 }
diff --git a/client/src/app/core/users/user-local-storage.service.ts b/client/src/app/core/users/user-local-storage.service.ts
index d15bf735b..fff649eef 100644
--- a/client/src/app/core/users/user-local-storage.service.ts
+++ b/client/src/app/core/users/user-local-storage.service.ts
@@ -2,8 +2,9 @@
2import { filter, throttleTime } from 'rxjs' 2import { filter, throttleTime } from 'rxjs'
3import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
4import { AuthService, AuthStatus } from '@app/core/auth' 4import { AuthService, AuthStatus } from '@app/core/auth'
5import { UserLocalStorageKeys, UserTokens } from '@root-helpers/users'
6import { getBoolOrDefault } from '@root-helpers/local-storage-utils' 5import { getBoolOrDefault } from '@root-helpers/local-storage-utils'
6import { logger } from '@root-helpers/logger'
7import { UserLocalStorageKeys, UserTokens } from '@root-helpers/users'
7import { UserRole, UserUpdateMe } from '@shared/models' 8import { UserRole, UserUpdateMe } from '@shared/models'
8import { NSFWPolicyType } from '@shared/models/videos' 9import { NSFWPolicyType } from '@shared/models/videos'
9import { ServerService } from '../server' 10import { ServerService } from '../server'
@@ -95,7 +96,7 @@ export class UserLocalStorageService {
95 : null 96 : null
96 } catch (err) { 97 } catch (err) {
97 videoLanguages = null 98 videoLanguages = null
98 console.error('Cannot parse desired video languages from localStorage.', err) 99 logger.error('Cannot parse desired video languages from localStorage.', err)
99 } 100 }
100 101
101 const htmlConfig = this.server.getHTMLConfig() 102 const htmlConfig = this.server.getHTMLConfig()
@@ -142,7 +143,7 @@ export class UserLocalStorageService {
142 143
143 this.localStorageService.setItem(key, localStorageValue) 144 this.localStorageService.setItem(key, localStorageValue)
144 } catch (err) { 145 } catch (err) {
145 console.error(`Cannot set ${key}->${value} in localStorage. Likely due to a value impossible to stringify.`, err) 146 logger.error(`Cannot set ${key}->${value} in localStorage. Likely due to a value impossible to stringify.`, err)
146 } 147 }
147 } 148 }
148 } 149 }
diff --git a/client/src/app/header/search-typeahead.component.ts b/client/src/app/header/search-typeahead.component.ts
index 0794ec8f4..d2549315c 100644
--- a/client/src/app/header/search-typeahead.component.ts
+++ b/client/src/app/header/search-typeahead.component.ts
@@ -4,6 +4,7 @@ import { ListKeyManager } from '@angular/cdk/a11y'
4import { AfterViewChecked, Component, OnDestroy, OnInit, QueryList, ViewChildren } from '@angular/core' 4import { AfterViewChecked, Component, OnDestroy, OnInit, QueryList, ViewChildren } from '@angular/core'
5import { ActivatedRoute, Params, Router } from '@angular/router' 5import { ActivatedRoute, Params, Router } from '@angular/router'
6import { AuthService, ServerService } from '@app/core' 6import { AuthService, ServerService } from '@app/core'
7import { logger } from '@root-helpers/logger'
7import { HTMLServerConfig, SearchTargetType } from '@shared/models' 8import { HTMLServerConfig, SearchTargetType } from '@shared/models'
8import { SuggestionComponent, SuggestionPayload, SuggestionPayloadType } from './suggestion.component' 9import { SuggestionComponent, SuggestionPayload, SuggestionPayloadType } from './suggestion.component'
9 10
@@ -91,7 +92,7 @@ export class SearchTypeaheadComponent implements OnInit, AfterViewChecked, OnDes
91 92
92 const activeIndex = this.suggestionItems.toArray().findIndex(i => i.result.default === true) 93 const activeIndex = this.suggestionItems.toArray().findIndex(i => i.result.default === true)
93 if (activeIndex === -1) { 94 if (activeIndex === -1) {
94 console.error('Cannot find active index.', { suggestionItems: this.suggestionItems }) 95 logger.error('Cannot find active index.', { suggestionItems: this.suggestionItems })
95 } 96 }
96 97
97 this.updateItemsState(activeIndex) 98 this.updateItemsState(activeIndex)
diff --git a/client/src/app/helpers/i18n-utils.ts b/client/src/app/helpers/i18n-utils.ts
index 2017a31ea..b7d73d16b 100644
--- a/client/src/app/helpers/i18n-utils.ts
+++ b/client/src/app/helpers/i18n-utils.ts
@@ -1,5 +1,6 @@
1import { environment } from '../../environments/environment'
2import IntlMessageFormat from 'intl-messageformat' 1import IntlMessageFormat from 'intl-messageformat'
2import { logger } from '@root-helpers/logger'
3import { environment } from '../../environments/environment'
3 4
4function isOnDevLocale () { 5function isOnDevLocale () {
5 return environment.production === false && window.location.search === '?lang=fr' 6 return environment.production === false && window.location.search === '?lang=fr'
@@ -19,14 +20,14 @@ function prepareIcu (icu: string) {
19 try { 20 try {
20 return msg.format(context) as string 21 return msg.format(context) as string
21 } catch (err) { 22 } catch (err) {
22 if (!alreadyWarned) console.warn('Cannot format ICU %s.', icu, err) 23 if (!alreadyWarned) logger.warn(`Cannot format ICU ${icu}.`, err)
23 24
24 alreadyWarned = true 25 alreadyWarned = true
25 return fallback 26 return fallback
26 } 27 }
27 } 28 }
28 } catch (err) { 29 } catch (err) {
29 console.warn('Cannot build intl message %s.', icu, err) 30 logger.warn(`Cannot build intl message ${icu}.`, err)
30 31
31 return (_context: unknown, fallback: string) => fallback 32 return (_context: unknown, fallback: string) => fallback
32 } 33 }
diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts
index 983f0a938..63f01df92 100644
--- a/client/src/app/menu/menu.component.ts
+++ b/client/src/app/menu/menu.component.ts
@@ -24,7 +24,7 @@ import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'
24import { PluginsManager } from '@root-helpers/plugins-manager' 24import { PluginsManager } from '@root-helpers/plugins-manager'
25import { HTMLServerConfig, ServerConfig, UserRight, VideoConstant } from '@shared/models' 25import { HTMLServerConfig, ServerConfig, UserRight, VideoConstant } from '@shared/models'
26 26
27const logger = debug('peertube:menu:MenuComponent') 27const debugLogger = debug('peertube:menu:MenuComponent')
28 28
29@Component({ 29@Component({
30 selector: 'my-menu', 30 selector: 'my-menu',
@@ -295,8 +295,8 @@ export class MenuComponent implements OnInit {
295 .pipe( 295 .pipe(
296 switchMap(() => this.user.computeCanSeeVideosLink(this.userService.getMyVideoQuotaUsed())) 296 switchMap(() => this.user.computeCanSeeVideosLink(this.userService.getMyVideoQuotaUsed()))
297 ).subscribe(res => { 297 ).subscribe(res => {
298 if (res === true) logger('User can see videos link.') 298 if (res === true) debugLogger('User can see videos link.')
299 else logger('User cannot see videos link.') 299 else debugLogger('User cannot see videos link.')
300 }) 300 })
301 } 301 }
302 302
diff --git a/client/src/app/modal/account-setup-warning-modal.component.ts b/client/src/app/modal/account-setup-warning-modal.component.ts
index c4cbf92b6..b999a3407 100644
--- a/client/src/app/modal/account-setup-warning-modal.component.ts
+++ b/client/src/app/modal/account-setup-warning-modal.component.ts
@@ -1,6 +1,7 @@
1import { Component, ElementRef, ViewChild } from '@angular/core' 1import { Component, ElementRef, ViewChild } from '@angular/core'
2import { Notifier, ServerService, User, UserService } from '@app/core' 2import { Notifier, ServerService, User, UserService } from '@app/core'
3import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' 3import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
4import { logger } from '@root-helpers/logger'
4import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' 5import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
5 6
6@Component({ 7@Component({
@@ -71,7 +72,7 @@ export class AccountSetupWarningModalComponent {
71 72
72 this.userService.updateMyProfile({ noAccountSetupWarningModal: true }) 73 this.userService.updateMyProfile({ noAccountSetupWarningModal: true })
73 .subscribe({ 74 .subscribe({
74 next: () => console.log('We will not open the account setup modal again.'), 75 next: () => logger.info('We will not open the account setup modal again.'),
75 76
76 error: err => this.notifier.error(err.message) 77 error: err => this.notifier.error(err.message)
77 }) 78 })
diff --git a/client/src/app/modal/admin-welcome-modal.component.ts b/client/src/app/modal/admin-welcome-modal.component.ts
index 3679f0847..7a9b89d3d 100644
--- a/client/src/app/modal/admin-welcome-modal.component.ts
+++ b/client/src/app/modal/admin-welcome-modal.component.ts
@@ -1,6 +1,7 @@
1import { Component, ElementRef, ViewChild } from '@angular/core' 1import { Component, ElementRef, ViewChild } from '@angular/core'
2import { Notifier, User, UserService } from '@app/core' 2import { Notifier, User, UserService } from '@app/core'
3import { NgbModal } from '@ng-bootstrap/ng-bootstrap' 3import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
4import { logger } from '@root-helpers/logger'
4import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' 5import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
5 6
6@Component({ 7@Component({
@@ -42,7 +43,7 @@ export class AdminWelcomeModalComponent {
42 43
43 this.userService.updateMyProfile({ noWelcomeModal: true }) 44 this.userService.updateMyProfile({ noWelcomeModal: true })
44 .subscribe({ 45 .subscribe({
45 next: () => console.log('We will not open the welcome modal again.'), 46 next: () => logger.info('We will not open the welcome modal again.'),
46 47
47 error: err => this.notifier.error(err.message) 48 error: err => this.notifier.error(err.message)
48 }) 49 })
diff --git a/client/src/app/modal/custom-modal.component.ts b/client/src/app/modal/custom-modal.component.ts
index 559230e04..49343ae71 100644
--- a/client/src/app/modal/custom-modal.component.ts
+++ b/client/src/app/modal/custom-modal.component.ts
@@ -1,5 +1,6 @@
1import { Component, ElementRef, ViewChild, Input } from '@angular/core' 1import { Component, ElementRef, Input, ViewChild } from '@angular/core'
2import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' 2import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
3import { logger } from '@root-helpers/logger'
3 4
4@Component({ 5@Component({
5 selector: 'my-custom-modal', 6 selector: 'my-custom-modal',
@@ -29,7 +30,7 @@ export class CustomModalComponent {
29 confirm?: { value: string, action?: () => void } 30 confirm?: { value: string, action?: () => void }
30 }) { 31 }) {
31 if (this.modalRef instanceof NgbModalRef && this.modalService.hasOpenModals()) { 32 if (this.modalRef instanceof NgbModalRef && this.modalService.hasOpenModals()) {
32 console.error('Cannot open another custom modal, one is already opened.') 33 logger.error('Cannot open another custom modal, one is already opened.')
33 return 34 return
34 } 35 }
35 36
diff --git a/client/src/app/modal/instance-config-warning-modal.component.ts b/client/src/app/modal/instance-config-warning-modal.component.ts
index 300738a41..23c2c777e 100644
--- a/client/src/app/modal/instance-config-warning-modal.component.ts
+++ b/client/src/app/modal/instance-config-warning-modal.component.ts
@@ -2,6 +2,7 @@ import { Location } from '@angular/common'
2import { Component, ElementRef, ViewChild } from '@angular/core' 2import { Component, ElementRef, ViewChild } from '@angular/core'
3import { Notifier, User, UserService } from '@app/core' 3import { Notifier, User, UserService } from '@app/core'
4import { NgbModal } from '@ng-bootstrap/ng-bootstrap' 4import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
5import { logger } from '@root-helpers/logger'
5import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' 6import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
6import { About, ServerConfig } from '@shared/models/server' 7import { About, ServerConfig } from '@shared/models/server'
7 8
@@ -64,7 +65,7 @@ export class InstanceConfigWarningModalComponent {
64 65
65 this.userService.updateMyProfile({ noInstanceConfigWarningModal: true }) 66 this.userService.updateMyProfile({ noInstanceConfigWarningModal: true })
66 .subscribe({ 67 .subscribe({
67 next: () => console.log('We will not open the instance config warning modal again.'), 68 next: () => logger.info('We will not open the instance config warning modal again.'),
68 69
69 error: err => this.notifier.error(err.message) 70 error: err => this.notifier.error(err.message)
70 }) 71 })
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 }
8import { Account, Actor, DropdownAction, Video, VideoService } from '@app/shared/shared-main' 8import { Account, Actor, DropdownAction, Video, VideoService } from '@app/shared/shared-main'
9import { AbuseService, BlocklistService, VideoBlockService } from '@app/shared/shared-moderation' 9import { AbuseService, BlocklistService, VideoBlockService } from '@app/shared/shared-moderation'
10import { VideoCommentService } from '@app/shared/shared-video-comment' 10import { VideoCommentService } from '@app/shared/shared-video-comment'
11import { logger } from '@root-helpers/logger'
11import { AbuseState, AdminAbuse } from '@shared/models' 12import { AbuseState, AdminAbuse } from '@shared/models'
12import { AdvancedInputFilter } from '../shared-forms' 13import { AdvancedInputFilter } from '../shared-forms'
13import { AbuseMessageModalComponent } from './abuse-message-modal.component' 14import { AbuseMessageModalComponent } from './abuse-message-modal.component'
14import { ModerationCommentModalComponent } from './moderation-comment-modal.component' 15import { ModerationCommentModalComponent } from './moderation-comment-modal.component'
15import { ProcessedAbuse } from './processed-abuse.model' 16import { ProcessedAbuse } from './processed-abuse.model'
16 17
17const logger = debug('peertube:moderation:AbuseListTableComponent') 18const 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'
3import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' 3import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
4import { NgbModal } from '@ng-bootstrap/ng-bootstrap' 4import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
5import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' 5import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
6import { logger } from '@root-helpers/logger'
6import { AbuseMessage, UserAbuse } from '@shared/models' 7import { AbuseMessage, UserAbuse } from '@shared/models'
7import { ABUSE_MESSAGE_VALIDATOR } from '../form-validators/abuse-validators' 8import { ABUSE_MESSAGE_VALIDATOR } from '../form-validators/abuse-validators'
8import { AbuseService } from '../shared-moderation' 9import { 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'
22import { CustomMarkupComponent } from './peertube-custom-tags/shared' 22import { CustomMarkupComponent } from './peertube-custom-tags/shared'
23import { logger } from '@root-helpers/logger'
23 24
24type AngularBuilderFunction = (el: HTMLElement) => ComponentRef<CustomMarkupComponent> 25type AngularBuilderFunction = (el: HTMLElement) => ComponentRef<CustomMarkupComponent>
25type HTMLBuilderFunction = (el: HTMLElement) => HTMLElement 26type 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
19const logger = debug('peertube:AdvancedInputFilterComponent') 19const 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
16const logger = debug('peertube:main:DeferLoadingDirective') 16const 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'
17import { NgbDropdown, NgbModal } from '@ng-bootstrap/ng-bootstrap' 17import { NgbDropdown, NgbModal } from '@ng-bootstrap/ng-bootstrap'
18import * as debug from 'debug' 18import * as debug from 'debug'
19 19
20const logger = debug('peertube:main:ListOverflowItem') 20const debugLogger = debug('peertube:main:ListOverflowItem')
21 21
22export interface ListOverflowItem { 22export 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'
2import { Account } from '@app/shared/shared-main/account/account.model' 2import { Account } from '@app/shared/shared-main/account/account.model'
3import { Actor } from '@app/shared/shared-main/account/actor.model' 3import { Actor } from '@app/shared/shared-main/account/actor.model'
4import { VideoChannel } from '@app/shared/shared-main/video-channel/video-channel.model' 4import { VideoChannel } from '@app/shared/shared-main/video-channel/video-channel.model'
5import { logger } from '@root-helpers/logger'
5import { 6import {
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'
9import { SearchService } from './search.service' 9import { SearchService } from './search.service'
10import { AdvancedSearch } from './advanced-search.model' 10import { AdvancedSearch } from './advanced-search.model'
11 11
12const logger = debug('peertube:search:FindInBulkService') 12const debugLogger = debug('peertube:search:FindInBulkService')
13 13
14type BulkObservables <P extends number | string, R> = { 14type 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 @@
1import { Component, Input, OnInit } from '@angular/core' 1import { Component, Input, OnInit } from '@angular/core'
2import { Notifier } from '@app/core' 2import { Notifier } from '@app/core'
3import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' 3import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
4import { logger } from '@root-helpers/logger'
4import { USER_HANDLE_VALIDATOR } from '../form-validators/user-validators' 5import { 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
9import { ActorFollow, ResultList, VideoChannel as VideoChannelServer, VideoSortField } from '@shared/models' 9import { ActorFollow, ResultList, VideoChannel as VideoChannelServer, VideoSortField } from '@shared/models'
10import { environment } from '../../../environments/environment' 10import { environment } from '../../../environments/environment'
11 11
12const logger = debug('peertube:subscriptions:UserSubscriptionService') 12const debugLogger = debug('peertube:subscriptions:UserSubscriptionService')
13 13
14type SubscriptionExistResult = { [ uri: string ]: boolean } 14type SubscriptionExistResult = { [ uri: string ]: boolean }
15type SubscriptionExistResultObservable = { [ uri: string ]: Observable<boolean> } 15type 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'
4import { Component, ElementRef, Inject, LOCALE_ID, ViewChild } from '@angular/core' 4import { Component, ElementRef, Inject, LOCALE_ID, ViewChild } from '@angular/core'
5import { AuthService, HooksService, Notifier } from '@app/core' 5import { AuthService, HooksService, Notifier } from '@app/core'
6import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' 6import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
7import { logger } from '@root-helpers/logger'
7import { VideoCaption, VideoFile, VideoPrivacy } from '@shared/models' 8import { VideoCaption, VideoFile, VideoPrivacy } from '@shared/models'
8import { BytesPipe, NumberFormatterPipe, VideoDetails, VideoService } from '../shared-main' 9import { 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'
8import { PeertubeModalService } from '../shared-main' 8import { PeertubeModalService } from '../shared-main'
9import { VideoFilters } from './video-filters.model' 9import { VideoFilters } from './video-filters.model'
10 10
11const logger = debug('peertube:videos:VideoFiltersHeaderComponent') 11const 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'
16import { GlobalIconName } from '@app/shared/shared-icons' 16import { GlobalIconName } from '@app/shared/shared-icons'
17import { logger } from '@root-helpers/logger'
17import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@shared/core-utils' 18import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@shared/core-utils'
18import { ResultList, UserRight, VideoSortField } from '@shared/models' 19import { ResultList, UserRight, VideoSortField } from '@shared/models'
19import { Syndication, Video } from '../shared-main' 20import { Syndication, Video } from '../shared-main'
20import { VideoFilters, VideoFilterScope } from './video-filters.model' 21import { VideoFilters, VideoFilterScope } from './video-filters.model'
21import { MiniatureDisplayOptions } from './video-miniature.component' 22import { MiniatureDisplayOptions } from './video-miniature.component'
22 23
23const logger = debug('peertube:videos:VideosListComponent') 24const debugLogger = debug('peertube:videos:VideosListComponent')
24 25
25export type HeaderAction = { 26export 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 @@
1import { Observable, Subject } from 'rxjs' 1import { Observable, Subject } from 'rxjs'
2import { AfterContentInit, Component, ContentChildren, EventEmitter, Input, Output, QueryList, TemplateRef } from '@angular/core' 2import { AfterContentInit, Component, ContentChildren, EventEmitter, Input, Output, QueryList, TemplateRef } from '@angular/core'
3import { ComponentPagination, Notifier, User } from '@app/core' 3import { ComponentPagination, Notifier, User } from '@app/core'
4import { logger } from '@root-helpers/logger'
4import { ResultList, VideoSortField } from '@shared/models' 5import { ResultList, VideoSortField } from '@shared/models'
5import { PeerTubeTemplateDirective, Video } from '../shared-main' 6import { PeerTubeTemplateDirective, Video } from '../shared-main'
6import { MiniatureDisplayOptions } from './video-miniature.component' 7import { 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 {
16import { VIDEO_PLAYLIST_DISPLAY_NAME_VALIDATOR } from '../form-validators/video-playlist-validators' 16import { VIDEO_PLAYLIST_DISPLAY_NAME_VALIDATOR } from '../form-validators/video-playlist-validators'
17import { CachedPlaylist, VideoPlaylistService } from './video-playlist.service' 17import { CachedPlaylist, VideoPlaylistService } from './video-playlist.service'
18 18
19const logger = debug('peertube:playlists:VideoAddToPlaylistComponent') 19const debugLogger = debug('peertube:playlists:VideoAddToPlaylistComponent')
20 20
21type PlaylistElement = { 21type 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'
23import { VideoPlaylistElement } from './video-playlist-element.model' 23import { VideoPlaylistElement } from './video-playlist-element.model'
24import { VideoPlaylist } from './video-playlist.model' 24import { VideoPlaylist } from './video-playlist.model'
25 25
26const logger = debug('peertube:playlists:VideoPlaylistService') 26const debugLogger = debug('peertube:playlists:VideoPlaylistService')
27 27
28export type CachedPlaylist = VideoPlaylist | { id: number, displayName: string } 28export 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