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.
@@ -43,7 +43,7 @@ async function Initializer(services) {
43
43
  exports.Initializer = Initializer;
44
44
  class APIService extends BaseService_1.BaseService {
45
45
  static nextLogID = 0;
46
- version = "1.4.0";
46
+ version = "1.4.2";
47
47
  options;
48
48
  netLog = [];
49
49
  constructor(options) {
@@ -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.id.toString(16) + " > " + logitem.date + " > " + text);
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",