Add get child
This commit is contained in:
parent
9182efe7e7
commit
2eb9356a9d
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hibas123/logging",
|
||||
"version": "2.3.0",
|
||||
"version": "2.3.1",
|
||||
"description": "",
|
||||
"main": "out/index.js",
|
||||
"types": "out/index.d.ts",
|
||||
|
10
src/base.ts
10
src/base.ts
@ -108,6 +108,16 @@ export class LoggingBase {
|
||||
this.flush = this.flush.bind(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
getChild(name: string) {
|
||||
let lg = new LoggingBase({ console: false, name });
|
||||
this.adapter.forEach((a) => lg.addAdapter(a));
|
||||
return lg;
|
||||
}
|
||||
|
||||
addAdapter(adapter: Adapter) {
|
||||
if (!this.adapter.has(adapter)) {
|
||||
this.adapter.add(adapter);
|
||||
|
Loading…
Reference in New Issue
Block a user