badmfck-api-server 1.4.2 → 1.4.3

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.
@@ -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.2";
46
+ version = "1.4.3";
47
47
  options;
48
48
  netLog = [];
49
49
  constructor(options) {
@@ -13,6 +13,7 @@ export interface ILogItem {
13
13
  time: number;
14
14
  text: string;
15
15
  date: string;
16
+ source: string;
16
17
  }
17
18
  export interface ILogServiceOptions {
18
19
  output?: (data?: any) => void;
@@ -83,9 +83,14 @@ class LogService extends BaseService_1.BaseService {
83
83
  const msg = log.data[0];
84
84
  const optional = log.data[1];
85
85
  let text = this.createText(msg);
86
+ let source = "";
87
+ if (text.startsWith("${") && text.endsWith("}") && text.indexOf(".js") !== -1) {
88
+ source = text.substring(2, text.length - 1);
89
+ text = "";
90
+ }
86
91
  if (optional) {
87
92
  for (let i of optional)
88
- text += ", " + this.createText(optional);
93
+ text += ", " + this.createText(i);
89
94
  }
90
95
  const d = new Date();
91
96
  const logitem = {
@@ -93,10 +98,11 @@ class LogService extends BaseService_1.BaseService {
93
98
  id: ((+new Date()) - this.epoch),
94
99
  text: text,
95
100
  time: d.getTime(),
96
- date: this.createDate(d)
101
+ date: this.createDate(d),
102
+ source: source
97
103
  };
98
104
  if (this.options.output)
99
- this.options.output(logitem.level + " > " + logitem.date + " > " + text);
105
+ this.options.output(logitem.source + " > " + logitem.level + " > " + logitem.date + " > " + text);
100
106
  exports.S_LOG_CREATED.invoke(logitem);
101
107
  this.log.push(logitem);
102
108
  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.2",
3
+ "version": "1.4.3",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",