*When fetching the logger in the plugin api, return a child instance of the logger instead for that plugin

This commit is contained in:
Derrick Hammer 2023-01-13 17:46:53 -05:00
parent 594e8d82a1
commit d5138c3860
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 5 additions and 1 deletions

View File

@ -77,7 +77,7 @@ class PluginAPI extends EventEmitter2 {
private _logger: Logger;
get logger(): Logger {
return this._logger;
throw new Error("not implemented and should not be called");
}
get rpcServer(): RPCServer {
@ -212,6 +212,10 @@ export class PluginAPIManager {
});
}
if (prop === "logger") {
return target.logger.child({ plugin: plugin.name });
}
return (target as any)[prop];
},
})