badmfck-api-server 1.4.0 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -17,6 +17,7 @@ export interface ILogItem {
|
|
17
17
|
export interface ILogServiceOptions {
|
18
18
|
output?: (data?: any) => void;
|
19
19
|
stackSize: number;
|
20
|
+
level: LOG_LEVEL;
|
20
21
|
}
|
21
22
|
export declare const getDefaultLogOptions: () => ILogServiceOptions;
|
22
23
|
export declare const logInfo: (message: any, ...optional: any[]) => void;
|
@@ -36,7 +36,8 @@ var LOG_LEVEL;
|
|
36
36
|
})(LOG_LEVEL || (exports.LOG_LEVEL = LOG_LEVEL = {}));
|
37
37
|
const getDefaultLogOptions = () => {
|
38
38
|
return {
|
39
|
-
stackSize: 1000
|
39
|
+
stackSize: 1000,
|
40
|
+
level: LOG_LEVEL.ALL
|
40
41
|
};
|
41
42
|
};
|
42
43
|
exports.getDefaultLogOptions = getDefaultLogOptions;
|
@@ -63,6 +64,7 @@ class LogService extends BaseService_1.BaseService {
|
|
63
64
|
if (!opt)
|
64
65
|
opt = (0, exports.getDefaultLogOptions)();
|
65
66
|
this.options = opt;
|
67
|
+
this.level = opt.level;
|
66
68
|
}
|
67
69
|
async init() {
|
68
70
|
exports.REQ_LOG.listener = async (req) => {
|
@@ -94,7 +96,7 @@ class LogService extends BaseService_1.BaseService {
|
|
94
96
|
date: this.createDate(d)
|
95
97
|
};
|
96
98
|
if (this.options.output)
|
97
|
-
this.options.output(logitem.level + " > " + logitem.
|
99
|
+
this.options.output(logitem.level + " > " + logitem.date + " > " + text);
|
98
100
|
exports.S_LOG_CREATED.invoke(logitem);
|
99
101
|
this.log.push(logitem);
|
100
102
|
let limit = this.options.stackSize ?? 1000;
|