diff --git a/client/common/videowatch/elements/share-chat.ts b/client/common/videowatch/elements/share-chat.ts index 49568a5c..a53eee5e 100644 --- a/client/common/videowatch/elements/share-chat.ts +++ b/client/common/videowatch/elements/share-chat.ts @@ -101,6 +101,11 @@ export class ShareChatElement extends LivechatElement { this._restorePreviousState() } + protected override updated (changedProperties: PropertyValues): void { + super.updated(changedProperties) + this.logger.info('Update!') + } + protected override render = (): TemplateResult => { return html` ${tplShareChatTabs(this)} diff --git a/client/utils/logger.ts b/client/utils/logger.ts index 6e30cb83..de65457b 100644 --- a/client/utils/logger.ts +++ b/client/utils/logger.ts @@ -2,13 +2,26 @@ // // SPDX-License-Identifier: AGPL-3.0-only -const logger = { - log: (s: string) => console.log('[peertube-plugin-livechat] ' + s), - info: (s: string) => console.info('[peertube-plugin-livechat] ' + s), - error: (s: string) => console.error('[peertube-plugin-livechat] ' + s), - warn: (s: string) => console.warn('[peertube-plugin-livechat] ' + s) +interface Logger { + log: (s: string) => void + info: (s: string) => void + error: (s: string) => void + warn: (s: string) => void + createLogger: (p: string) => Logger } +function createLogger (prefix: string): Logger { + return { + log: (s: string) => console.log('[' + prefix + '] ' + s), + info: (s: string) => console.info('[' + prefix + '] ' + s), + error: (s: string) => console.error('[' + prefix + '] ' + s), + warn: (s: string) => console.warn('[' + prefix + '] ' + s), + createLogger: (p: string) => createLogger('peertube-plugin-livechat>' + p) + } +} + +const logger = createLogger('peertube-plugin-livechat') + export { logger }