jet-logger 1.1.4 → 1.1.5
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/lib/index.d.ts +0 -22
- package/lib/index.js +6 -7
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -8,25 +8,6 @@ export declare enum Formats {
|
|
|
8
8
|
Line = "LINE",
|
|
9
9
|
Json = "JSON"
|
|
10
10
|
}
|
|
11
|
-
declare const levels: {
|
|
12
|
-
info: {
|
|
13
|
-
color: string;
|
|
14
|
-
prefix: string;
|
|
15
|
-
};
|
|
16
|
-
imp: {
|
|
17
|
-
color: string;
|
|
18
|
-
prefix: string;
|
|
19
|
-
};
|
|
20
|
-
warn: {
|
|
21
|
-
color: string;
|
|
22
|
-
prefix: string;
|
|
23
|
-
};
|
|
24
|
-
err: {
|
|
25
|
-
color: string;
|
|
26
|
-
prefix: string;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
declare type TLevelProp = typeof levels[keyof typeof levels];
|
|
30
11
|
declare type TJetLogger = ReturnType<typeof JetLogger>;
|
|
31
12
|
export declare type TCustomLogger = (timestamp: Date, prefix: string, content: any) => void;
|
|
32
13
|
export declare function JetLogger(mode?: LoggerModes, filePath?: string, timestamp?: boolean, format?: Formats, customLogger?: TCustomLogger): {
|
|
@@ -41,13 +22,11 @@ export declare function JetLogger(mode?: LoggerModes, filePath?: string, timesta
|
|
|
41
22
|
readonly imp: typeof imp;
|
|
42
23
|
readonly warn: typeof warn;
|
|
43
24
|
readonly err: typeof err;
|
|
44
|
-
readonly printLog: typeof printLog;
|
|
45
25
|
};
|
|
46
26
|
declare function info(this: TJetLogger, content: any, printFull?: boolean): void;
|
|
47
27
|
declare function imp(this: TJetLogger, content: any, printFull?: boolean): void;
|
|
48
28
|
declare function warn(this: TJetLogger, content: any, printFull?: boolean): void;
|
|
49
29
|
declare function err(this: TJetLogger, content: any, printFull?: boolean): void;
|
|
50
|
-
declare function printLog(this: TJetLogger, content: any, printFull: boolean, level: TLevelProp): void;
|
|
51
30
|
declare const _default: {
|
|
52
31
|
readonly settings: {
|
|
53
32
|
readonly mode: LoggerModes;
|
|
@@ -60,6 +39,5 @@ declare const _default: {
|
|
|
60
39
|
readonly imp: typeof imp;
|
|
61
40
|
readonly warn: typeof warn;
|
|
62
41
|
readonly err: typeof err;
|
|
63
|
-
readonly printLog: typeof printLog;
|
|
64
42
|
};
|
|
65
43
|
export default _default;
|
package/lib/index.js
CHANGED
|
@@ -55,7 +55,6 @@ function JetLogger(mode, filePath, timestamp, format, customLogger) {
|
|
|
55
55
|
imp: imp,
|
|
56
56
|
warn: warn,
|
|
57
57
|
err: err,
|
|
58
|
-
printLog: printLog,
|
|
59
58
|
};
|
|
60
59
|
}
|
|
61
60
|
exports.JetLogger = JetLogger;
|
|
@@ -101,19 +100,19 @@ function getSettings(mode, filePath, timestamp, format, customLogger) {
|
|
|
101
100
|
};
|
|
102
101
|
}
|
|
103
102
|
function info(content, printFull) {
|
|
104
|
-
return
|
|
103
|
+
return printLog(content, printFull !== null && printFull !== void 0 ? printFull : false, levels.info, this.settings);
|
|
105
104
|
}
|
|
106
105
|
function imp(content, printFull) {
|
|
107
|
-
return
|
|
106
|
+
return printLog(content, printFull !== null && printFull !== void 0 ? printFull : false, levels.imp, this.settings);
|
|
108
107
|
}
|
|
109
108
|
function warn(content, printFull) {
|
|
110
|
-
return
|
|
109
|
+
return printLog(content, printFull !== null && printFull !== void 0 ? printFull : false, levels.warn, this.settings);
|
|
111
110
|
}
|
|
112
111
|
function err(content, printFull) {
|
|
113
|
-
return
|
|
112
|
+
return printLog(content, printFull !== null && printFull !== void 0 ? printFull : false, levels.err, this.settings);
|
|
114
113
|
}
|
|
115
|
-
function printLog(content, printFull, level) {
|
|
116
|
-
var
|
|
114
|
+
function printLog(content, printFull, level, settings) {
|
|
115
|
+
var mode = settings.mode, format = settings.format, timestamp = settings.timestamp, filePath = settings.filePath, customLogger = settings.customLogger;
|
|
117
116
|
if (mode === LoggerModes.Off) {
|
|
118
117
|
return;
|
|
119
118
|
}
|