Changing naming scheme of getChild

This commit is contained in:
Fabian Stamm 2020-04-11 16:48:27 +02:00
parent f51f4e2aad
commit a1cd860688
2 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@hibas123/logging", "name": "@hibas123/logging",
"version": "2.3.2", "version": "2.3.4",
"description": "", "description": "",
"main": "out/index.js", "main": "out/index.js",
"types": "out/index.d.ts", "types": "out/index.d.ts",

View File

@ -110,10 +110,13 @@ export class LoggingBase {
/** /**
* Creates a new logging instance, with all the adapters from this one. After that the new Instance operates independent * Creates a new logging instance, with all the adapters from this one. After that the new Instance operates independent
* @param name Name/Prefix of the new child * @param name Name/Prefix of the new child. The actual name will resolve as "<parent-name>/<name>"
*/ */
getChild(name: string) { getChild(name: string) {
let lg = new LoggingBase({ console: false, name }); let lg = new LoggingBase({
console: false,
name: this.name ? this.name + "/" + name : name,
});
this.adapter.forEach((a) => lg.addAdapter(a)); this.adapter.forEach((a) => lg.addAdapter(a));
return lg; return lg;
} }