diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-04 11:14:21 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-04 15:45:44 +0200 |
commit | 584ac47a323d6e57233fce4451d43d4943bfaa10 (patch) | |
tree | 5f6238578051080e0aceb26ed061180d1f8db095 | |
parent | 91f8f8db97ffb83701c30f9cdb1e804670434eb0 (diff) | |
download | PeerTube-584ac47a323d6e57233fce4451d43d4943bfaa10.tar.gz PeerTube-584ac47a323d6e57233fce4451d43d4943bfaa10.tar.zst PeerTube-584ac47a323d6e57233fce4451d43d4943bfaa10.zip |
Add debug logs to plugin service
-rw-r--r-- | client/src/app/core/plugins/plugin.service.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts index a3de98390..dff8ad864 100644 --- a/client/src/app/core/plugins/plugin.service.ts +++ b/client/src/app/core/plugins/plugin.service.ts | |||
@@ -24,6 +24,9 @@ import { | |||
24 | } from '@shared/models' | 24 | } from '@shared/models' |
25 | import { environment } from '../../../environments/environment' | 25 | import { environment } from '../../../environments/environment' |
26 | import { RegisterClientHelpers } from '../../../types/register-client-option.model' | 26 | import { RegisterClientHelpers } from '../../../types/register-client-option.model' |
27 | import * as debug from 'debug' | ||
28 | |||
29 | const logger = debug('peertube:plugins') | ||
27 | 30 | ||
28 | @Injectable() | 31 | @Injectable() |
29 | export class PluginService implements ClientHook { | 32 | export class PluginService implements ClientHook { |
@@ -76,6 +79,8 @@ export class PluginService implements ClientHook { | |||
76 | } | 79 | } |
77 | 80 | ||
78 | initializePlugins () { | 81 | initializePlugins () { |
82 | logger('Building plugin configuration') | ||
83 | |||
79 | this.server.getConfig() | 84 | this.server.getConfig() |
80 | .subscribe(config => { | 85 | .subscribe(config => { |
81 | this.plugins = config.plugin.registered | 86 | this.plugins = config.plugin.registered |
@@ -83,6 +88,8 @@ export class PluginService implements ClientHook { | |||
83 | this.buildScopeStruct() | 88 | this.buildScopeStruct() |
84 | 89 | ||
85 | this.pluginsBuilt.next(true) | 90 | this.pluginsBuilt.next(true) |
91 | |||
92 | logger('Plugin configuration built') | ||
86 | }) | 93 | }) |
87 | } | 94 | } |
88 | 95 | ||
@@ -146,6 +153,8 @@ export class PluginService implements ClientHook { | |||
146 | 153 | ||
147 | this.loadingScopes[scope] = true | 154 | this.loadingScopes[scope] = true |
148 | 155 | ||
156 | logger('Loading scope %s', scope) | ||
157 | |||
149 | try { | 158 | try { |
150 | await this.ensurePluginsAreBuilt() | 159 | await this.ensurePluginsAreBuilt() |
151 | 160 | ||
@@ -156,6 +165,7 @@ export class PluginService implements ClientHook { | |||
156 | this.loadingScopes[scope] = false | 165 | this.loadingScopes[scope] = false |
157 | this.pluginsLoaded[scope].next(true) | 166 | this.pluginsLoaded[scope].next(true) |
158 | 167 | ||
168 | logger('Nothing to load for scope %s', scope) | ||
159 | return | 169 | return |
160 | } | 170 | } |
161 | 171 | ||
@@ -174,6 +184,8 @@ export class PluginService implements ClientHook { | |||
174 | 184 | ||
175 | this.pluginsLoaded[scope].next(true) | 185 | this.pluginsLoaded[scope].next(true) |
176 | this.loadingScopes[scope] = false | 186 | this.loadingScopes[scope] = false |
187 | |||
188 | logger('Scope %s loaded', scope) | ||
177 | } catch (err) { | 189 | } catch (err) { |
178 | console.error('Cannot load plugins by scope %s.', scope, err) | 190 | console.error('Cannot load plugins by scope %s.', scope, err) |
179 | } | 191 | } |