nestjs-pino 3.1.3 → 3.2.0-alpha.0c3e5b

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.
Files changed (2) hide show
  1. package/PinoLogger.d.ts +17 -3
  2. package/package.json +2 -2
package/PinoLogger.d.ts CHANGED
@@ -1,6 +1,20 @@
1
1
  import pino from 'pino';
2
2
  import { Params } from './params';
3
3
  type PinoMethods = Pick<pino.Logger, 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal'>;
4
+ /**
5
+ * This is copy of pino.LogFn but with possibilty to make method override.
6
+ * Current usage works:
7
+ *
8
+ * trace(msg: string, ...args: any[]): void;
9
+ * trace(obj: object, msg?: string, ...args: any[]): void;
10
+ * trace(...args: Parameters<LoggerFn>) {
11
+ * this.call('trace', ...args);
12
+ * }
13
+ *
14
+ * But if change local LoggerFn to pino.LogFn – this will say that overrides
15
+ * are incompatible
16
+ */
17
+ type LoggerFn = ((msg: string, ...args: any[]) => void) | ((obj: object, msg?: string, ...args: any[]) => void);
4
18
  export declare function __resetOutOfContextForTests(): void;
5
19
  export declare class PinoLogger implements PinoMethods {
6
20
  /**
@@ -9,8 +23,8 @@ export declare class PinoLogger implements PinoMethods {
9
23
  * Readonly, but you can change it's properties.
10
24
  */
11
25
  static readonly root: pino.Logger;
12
- private context;
13
- private readonly contextName;
26
+ protected context: string;
27
+ protected readonly contextName: string;
14
28
  constructor({ pinoHttp, renameContext }: Params);
15
29
  trace(msg: string, ...args: any[]): void;
16
30
  trace(obj: unknown, msg?: string, ...args: any[]): void;
@@ -25,7 +39,7 @@ export declare class PinoLogger implements PinoMethods {
25
39
  fatal(msg: string, ...args: any[]): void;
26
40
  fatal(obj: unknown, msg?: string, ...args: any[]): void;
27
41
  setContext(value: string): void;
28
- private call;
42
+ protected call(method: pino.Level, ...args: Parameters<LoggerFn>): void;
29
43
  get logger(): pino.Logger;
30
44
  assign(fields: pino.Bindings): void;
31
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nestjs-pino",
3
- "version": "3.1.3",
3
+ "version": "3.2.0-alpha.0c3e5b",
4
4
  "description": "Pino logger for NestJS",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -47,7 +47,7 @@
47
47
  "@types/express": "^4.17.17",
48
48
  "@types/jest": "^29.5.0",
49
49
  "@types/memorystream": "^0.3.1",
50
- "@types/node": "^18.15.11",
50
+ "@types/node": "^20.1.0",
51
51
  "@types/supertest": "^2.0.12",
52
52
  "@typescript-eslint/eslint-plugin": "^5.59.0",
53
53
  "@typescript-eslint/parser": "^5.59.0",