diff --git a/src/backend/scrobblers/ScrobbleClients.ts b/src/backend/scrobblers/ScrobbleClients.ts index bea4097f..63d18371 100644 --- a/src/backend/scrobblers/ScrobbleClients.ts +++ b/src/backend/scrobblers/ScrobbleClients.ts @@ -292,7 +292,7 @@ ${sources.join('\n')}`); try { await this.addClient(c, clientDefaults, notifier); } catch(e) { - const addError = new Error(`Client ${c.name} was not added because it had unrecoverable errors`, {cause: e}); + const addError = new Error(`Client ${c.name} from ${c.source} was not added because it had unrecoverable errors`, {cause: e}); this.emitter.emit('error', addError); this.logger.error(addError); } @@ -304,17 +304,17 @@ ${sources.join('\n')}`); if (isValidConfig !== true) { throw new Error(`Config object from ${clientConfig.source || 'unknown'} with name [${clientConfig.name || 'unnamed'}] of type [${clientConfig.type || 'unknown'}] has errors: ${isValidConfig.join(' | ')}`) }*/ - const {type, name, enable = true, data: d = {}} = clientConfig; + const {type, name, enable = true, source, data: d = {}} = clientConfig; if(enable === false) { - this.logger.warn(`${type} (${name}) client was disabled by config`); + this.logger.warn({labels: [`${type} - ${name}`]}, `Client from ${source} was disabled by config`); return; } // add defaults const data = {...defaults, ...d}; let newClient; - this.logger.debug(`Constructing ${type} (${name}) client...`); + this.logger.debug({labels: [`${type} - ${name}`]}, `Constructing Client from ${source}`); switch (type) { case 'maloja': newClient = new MalojaScrobbler(name, ({...clientConfig, data} as unknown as MalojaClientConfig), notifier, this.emitter, this.logger); @@ -331,9 +331,9 @@ ${sources.join('\n')}`); if(newClient === undefined) { // really shouldn't get here! - throw new Error(`Client of type ${type} was not recognized??`); + throw new Error(`Client of type ${type} from ${source} was not recognized??`); } - newClient.logger.info('Client Added'); + newClient.logger.info(`Client Added from ${source}`); this.clients.push(newClient); } diff --git a/src/backend/sources/ScrobbleSources.ts b/src/backend/sources/ScrobbleSources.ts index 99bd64cd..7f535f54 100644 --- a/src/backend/sources/ScrobbleSources.ts +++ b/src/backend/sources/ScrobbleSources.ts @@ -753,7 +753,7 @@ export default class ScrobbleSources { try { await this.addSource(c, sourceDefaults); } catch(e) { - const addError = new Error(`Source ${c.name} of type ${c.type} was not added because of unrecoverable errors`, {cause: e}); + const addError = new Error(`Source ${c.name} of type ${c.type} from source ${c.source} was not added because of unrecoverable errors`, {cause: e}); this.emitter.emit('error', addError); this.logger.error(addError); } @@ -768,17 +768,17 @@ export default class ScrobbleSources { // throw new Error(`Config object from ${clientConfig.source || 'unknown'} with name [${clientConfig.name || 'unnamed'}] of type [${clientConfig.type || 'unknown'}] has errors: ${isValidConfig.join(' | ')}`) // } - const {type, name, data: d = {}, enable = true, options: clientOptions = {}} = clientConfig; + const {type, name, data: d = {}, enable = true, source, options: clientOptions = {}} = clientConfig; if(enable === false) { - this.logger.warn(`${type} (${name}) source was disabled by config`); + this.logger.warn({labels: [`${type} - ${name}`]},`Source from ${source} was disabled by config`); return; } // add defaults const compositeConfig: SourceConfig = {...clientConfig, data: d, options: {...defaults, ...clientOptions}}; - this.logger.debug(`(${name}) Constructing ${type} source`); + this.logger.debug({labels: [`${type} - ${name}`]},`Constructing Source from ${source}...`); let newSource: AbstractSource; switch (type) { case 'spotify': @@ -871,9 +871,10 @@ export default class ScrobbleSources { if(newSource === undefined) { // really shouldn't get here! - this.logger.error(new Error(`Source of type ${type} was not recognized??`)); + this.logger.error(new Error(`Source of type ${type} from ${source} was not recognized??`)); return; } this.sources.push(newSource); + newSource.logger.info(`Source Added from ${source}`); } }