egonlog 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +5 -2
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export type LogLevel = "error" | "warn" | "info" | "debug";
|
|
2
|
-
export
|
|
2
|
+
export type EgonLogConfig = {
|
|
3
|
+
level: LogLevel;
|
|
4
|
+
};
|
|
5
|
+
export declare class EgonLog {
|
|
3
6
|
private level;
|
|
4
7
|
private timers;
|
|
5
|
-
constructor(
|
|
8
|
+
constructor(config: EgonLogConfig);
|
|
6
9
|
private shouldLog;
|
|
7
10
|
private log;
|
|
8
11
|
error(...args: unknown[]): void;
|
package/dist/index.js
CHANGED
|
@@ -5,11 +5,11 @@ const LOG_LEVELS = {
|
|
|
5
5
|
info: 2,
|
|
6
6
|
debug: 3,
|
|
7
7
|
};
|
|
8
|
-
export class
|
|
8
|
+
export class EgonLog {
|
|
9
9
|
level;
|
|
10
10
|
timers = {};
|
|
11
|
-
constructor(
|
|
12
|
-
this.level = level;
|
|
11
|
+
constructor(config) {
|
|
12
|
+
this.level = config.level;
|
|
13
13
|
}
|
|
14
14
|
shouldLog(messageLevel) {
|
|
15
15
|
return LOG_LEVELS[messageLevel] <= LOG_LEVELS[this.level];
|