Changing name again

This commit is contained in:
Fabian Stamm 2021-05-08 22:15:56 +02:00
parent 96d7808f35
commit 357b98c69a
5 changed files with 18 additions and 3862 deletions

View File

@ -1,6 +1,6 @@
{
"name": "logging",
"version": "3.0.0",
"version": "3.0.1",
"description": "",
"author": "Fabian Stamm <dev@fabianstamm.de>",
"contributors": [],

3844
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -134,7 +134,7 @@ export abstract class LoggingInterface implements ILoggingInterface {
this.#timerMap.set(id, {
name: id,
start: Logging.nativeFunctions.startTimer(),
start: LoggingBase.nativeFunctions.startTimer(),
});
return {
@ -146,7 +146,7 @@ export abstract class LoggingInterface implements ILoggingInterface {
timeEnd(id: string) {
let timer = this.#timerMap.get(id);
if (timer) {
let diff = Logging.nativeFunctions.endTimer(timer.start);
let diff = LoggingBase.nativeFunctions.endTimer(timer.start);
this.message(LoggingTypes.Debug, this.#names, [
Format.green(`[${timer.name}]`),
@ -163,13 +163,13 @@ export abstract class LoggingInterface implements ILoggingInterface {
abstract getChild(name: string): ILoggingInterface;
}
export class Logging extends LoggingInterface {
export class LoggingBase extends LoggingInterface {
private static [InitialisedAdapters] = new Map<Adapter, number>();
public static nativeFunctions: INativeFunctions = DefaultNativeFunctions;
static DecoupledLogging = class extends LoggingInterface {
#lg: Logging;
constructor(names: string[], lg: Logging) {
#lg: LoggingBase;
constructor(names: string[], lg: LoggingBase) {
super(names);
this.#lg = lg;
}
@ -179,7 +179,7 @@ export class Logging extends LoggingInterface {
}
getChild(name: string) {
return new Logging.DecoupledLogging([this.names, name], this.#lg);
return new LoggingBase.DecoupledLogging([this.names, name], this.#lg);
}
};
@ -221,13 +221,13 @@ export class Logging extends LoggingInterface {
const add = () => {
this.#adapters.add(adapter);
if (Logging[InitialisedAdapters].has(adapter)) {
Logging[InitialisedAdapters].set(
if (LoggingBase[InitialisedAdapters].has(adapter)) {
LoggingBase[InitialisedAdapters].set(
adapter,
Logging[InitialisedAdapters].get(adapter) + 1
LoggingBase[InitialisedAdapters].get(adapter) + 1
);
} else {
Logging[InitialisedAdapters].set(adapter, 1);
LoggingBase[InitialisedAdapters].set(adapter, 1);
}
};
@ -239,7 +239,7 @@ export class Logging extends LoggingInterface {
}
getChild(name: string): ILoggingInterface {
return new Logging.DecoupledLogging([...this.names, name], this);
return new LoggingBase.DecoupledLogging([...this.names, name], this);
}
protected message(
@ -389,15 +389,15 @@ export class Logging extends LoggingInterface {
this.#closed = true;
this.#adapters.forEach((adapter) => {
const cnt = Logging[InitialisedAdapters].get(adapter);
const cnt = LoggingBase[InitialisedAdapters].get(adapter);
if (!cnt) {
//TODO: should not happen!
} else {
if (cnt <= 1) {
adapter.close();
Logging[InitialisedAdapters].delete(adapter);
LoggingBase[InitialisedAdapters].delete(adapter);
} else {
Logging[InitialisedAdapters].set(adapter, cnt - 1);
LoggingBase[InitialisedAdapters].set(adapter, cnt - 1);
}
}
});

View File

@ -1,5 +1,5 @@
import { Logging as LoggingClass } from "./base.js";
export { Logging } from "./base.js";
import { LoggingBase as LoggingClass } from "./base.js";
export { LoggingBase as Logging } from "./base.js";
export { ConsoleAdapter } from "./consolewriter.js";
export { ILoggingOptions, INativeFunctions } from "./base.js";