infront-logger 1.0.5 → 1.0.7

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.es.js CHANGED
@@ -291,7 +291,11 @@ class BaseLogger {
291
291
  return this;
292
292
  }
293
293
  context(key, value) {
294
- this.ctx[key] = value;
294
+ if (typeof key === "string") {
295
+ this.ctx[key] = value;
296
+ } else if (typeof key === "object") {
297
+ Object.assign(this.ctx, key);
298
+ }
295
299
  return this;
296
300
  }
297
301
  }
package/dist/index.umd.js CHANGED
@@ -295,7 +295,11 @@
295
295
  return this;
296
296
  }
297
297
  context(key, value) {
298
- this.ctx[key] = value;
298
+ if (typeof key === "string") {
299
+ this.ctx[key] = value;
300
+ } else if (typeof key === "object") {
301
+ Object.assign(this.ctx, key);
302
+ }
299
303
  return this;
300
304
  }
301
305
  }
package/lib/main.d.ts ADDED
@@ -0,0 +1,48 @@
1
+ export class BaseLogger {
2
+ constructor(component: string, options?: any);
3
+
4
+ session(id: string): this;
5
+
6
+ log(...args: any[]): void;
7
+
8
+ info(...args: any[]): void;
9
+
10
+ error(...args: any[]): void;
11
+
12
+ profile(action: string, options?: { continue?: boolean }): this;
13
+
14
+ profileMem(options?: { interval?: number }): this;
15
+
16
+ context(key: string , value: any): this;
17
+ context(key: any ): this;
18
+ }
19
+
20
+ export class HTTPLogger extends BaseLogger {
21
+ constructor(startTime: number, options?: any);
22
+
23
+ request(req: HttpRequest): this;
24
+
25
+ response(res: HttpResponse): this;
26
+
27
+ body(data: any): this;
28
+
29
+ success(req: HttpRequest, res: HttpResponse, body?: any): void;
30
+
31
+ error(err: any): void;
32
+ }
33
+
34
+ export class MongooseLogger extends BaseLogger {
35
+ constructor(options?: any);
36
+
37
+ operation(o: string): this;
38
+
39
+ collection(c: string): this;
40
+
41
+ query(q: any): this;
42
+
43
+ update(u: any): this;
44
+
45
+ pipeline(p: any[]): this;
46
+
47
+ result(res: any): this;
48
+ }
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "infront-logger",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
5
  "files": [
6
6
  "dist",
7
- "lib/index.d.ts"
7
+ "lib/main.d.ts"
8
8
  ],
9
9
  "main": "./dist/index.umd.js",
10
10
  "module": "./dist/index.es.js",
11
- "types": "./dist/main.d.ts",
11
+ "types": "lib/main.d.ts",
12
12
  "exports": {
13
13
  ".": {
14
14
  "import": "./dist/index.es.js",