nestjs-pino 2.3.1 → 2.4.0-alpha.0c6bc7
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/LoggerModule.js +3 -3
- package/PinoLogger.d.ts +8 -8
- package/PinoLogger.js +4 -4
- package/README.md +2 -2
- package/package.json +6 -6
- package/params.d.ts +4 -5
package/LoggerModule.js
CHANGED
|
@@ -15,7 +15,7 @@ var LoggerModule_1;
|
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.LoggerModule = void 0;
|
|
17
17
|
const common_1 = require("@nestjs/common");
|
|
18
|
-
const
|
|
18
|
+
const pino_http_1 = require("pino-http");
|
|
19
19
|
const Logger_1 = require("./Logger");
|
|
20
20
|
const params_1 = require("./params");
|
|
21
21
|
const PinoLogger_1 = require("./PinoLogger");
|
|
@@ -85,13 +85,13 @@ function createLoggerMiddlewares(params, useExisting) {
|
|
|
85
85
|
return [bindLoggerMiddleware];
|
|
86
86
|
}
|
|
87
87
|
if (Array.isArray(params)) {
|
|
88
|
-
const middleware = pinoHttp(...params);
|
|
88
|
+
const middleware = (0, pino_http_1.pinoHttp)(...params);
|
|
89
89
|
// @ts-expect-error: root is readonly field, but this is the place where
|
|
90
90
|
// it's set actually
|
|
91
91
|
PinoLogger_1.PinoLogger.root = middleware.logger;
|
|
92
92
|
return [middleware, bindLoggerMiddleware];
|
|
93
93
|
}
|
|
94
|
-
const middleware = pinoHttp(params);
|
|
94
|
+
const middleware = (0, pino_http_1.pinoHttp)(params);
|
|
95
95
|
// @ts-expect-error: root is readonly field, but this is the place where
|
|
96
96
|
// it's set actually
|
|
97
97
|
PinoLogger_1.PinoLogger.root = middleware.logger;
|
package/PinoLogger.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import pino from 'pino';
|
|
2
2
|
import { Params } from './params';
|
|
3
|
-
declare type PinoMethods = Pick<pino.
|
|
3
|
+
declare type PinoMethods = Pick<pino.Logger, 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal'>;
|
|
4
4
|
export declare function __resetOutOfContextForTests(): void;
|
|
5
5
|
export declare class PinoLogger implements PinoMethods {
|
|
6
6
|
/**
|
|
@@ -13,17 +13,17 @@ export declare class PinoLogger implements PinoMethods {
|
|
|
13
13
|
private readonly contextName;
|
|
14
14
|
constructor({ pinoHttp, renameContext }: Params);
|
|
15
15
|
trace(msg: string, ...args: any[]): void;
|
|
16
|
-
trace(obj:
|
|
16
|
+
trace(obj: unknown, msg?: string, ...args: any[]): void;
|
|
17
17
|
debug(msg: string, ...args: any[]): void;
|
|
18
|
-
debug(obj:
|
|
18
|
+
debug(obj: unknown, msg?: string, ...args: any[]): void;
|
|
19
19
|
info(msg: string, ...args: any[]): void;
|
|
20
|
-
info(obj:
|
|
20
|
+
info(obj: unknown, msg?: string, ...args: any[]): void;
|
|
21
21
|
warn(msg: string, ...args: any[]): void;
|
|
22
|
-
warn(obj:
|
|
22
|
+
warn(obj: unknown, msg?: string, ...args: any[]): void;
|
|
23
23
|
error(msg: string, ...args: any[]): void;
|
|
24
|
-
error(obj:
|
|
24
|
+
error(obj: unknown, msg?: string, ...args: any[]): void;
|
|
25
25
|
fatal(msg: string, ...args: any[]): void;
|
|
26
|
-
fatal(obj:
|
|
26
|
+
fatal(obj: unknown, msg?: string, ...args: any[]): void;
|
|
27
27
|
setContext(value: string): void;
|
|
28
28
|
private call;
|
|
29
29
|
get logger(): pino.Logger;
|
package/PinoLogger.js
CHANGED
|
@@ -16,7 +16,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
exports.PinoLogger = exports.__resetOutOfContextForTests = void 0;
|
|
17
17
|
/* eslint-disable @typescript-eslint/ban-types */
|
|
18
18
|
const common_1 = require("@nestjs/common");
|
|
19
|
-
const
|
|
19
|
+
const pino_1 = require("pino");
|
|
20
20
|
const params_1 = require("./params");
|
|
21
21
|
const storage_1 = require("./storage");
|
|
22
22
|
let outOfContext;
|
|
@@ -31,7 +31,7 @@ let PinoLogger = PinoLogger_1 = class PinoLogger {
|
|
|
31
31
|
this.context = '';
|
|
32
32
|
if (!outOfContext) {
|
|
33
33
|
if (Array.isArray(pinoHttp)) {
|
|
34
|
-
outOfContext =
|
|
34
|
+
outOfContext = (0, pino_1.default)(...pinoHttp);
|
|
35
35
|
}
|
|
36
36
|
else if ((0, params_1.isPassedLogger)(pinoHttp)) {
|
|
37
37
|
outOfContext = pinoHttp.logger;
|
|
@@ -39,10 +39,10 @@ let PinoLogger = PinoLogger_1 = class PinoLogger {
|
|
|
39
39
|
else if (typeof pinoHttp === 'object' &&
|
|
40
40
|
'stream' in pinoHttp &&
|
|
41
41
|
typeof pinoHttp.stream !== 'undefined') {
|
|
42
|
-
outOfContext =
|
|
42
|
+
outOfContext = (0, pino_1.default)(pinoHttp, pinoHttp.stream);
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
|
-
outOfContext =
|
|
45
|
+
outOfContext = (0, pino_1.default)(pinoHttp);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
this.contextName = renameContext || 'context';
|
package/README.md
CHANGED
|
@@ -233,7 +233,7 @@ import { LoggerModule } from 'nestjs-pino';
|
|
|
233
233
|
// install 'pino-pretty' package in order to use the following option
|
|
234
234
|
transport: process.env.NODE_ENV !== 'production'
|
|
235
235
|
? { target: 'pino-pretty' }
|
|
236
|
-
:
|
|
236
|
+
: undefined,
|
|
237
237
|
useLevelLabels: true,
|
|
238
238
|
// and all the others...
|
|
239
239
|
},
|
|
@@ -297,7 +297,7 @@ Please, read [pino extreme mode docs](https://github.com/pinojs/pino/blob/master
|
|
|
297
297
|
If you know what you're doing, you can enable it like so:
|
|
298
298
|
|
|
299
299
|
```ts
|
|
300
|
-
import
|
|
300
|
+
import pino from 'pino';
|
|
301
301
|
import { LoggerModule } from 'nestjs-pino';
|
|
302
302
|
|
|
303
303
|
const dest = pino.extreme();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nestjs-pino",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0-alpha.0c6bc7",
|
|
4
4
|
"description": "Pino logger for NestJS",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -46,8 +46,7 @@
|
|
|
46
46
|
"@types/express": "^4.17.13",
|
|
47
47
|
"@types/jest": "^27.0.1",
|
|
48
48
|
"@types/memorystream": "^0.3.0",
|
|
49
|
-
"@types/node": "^
|
|
50
|
-
"@types/pino-http": "^5.4.3",
|
|
49
|
+
"@types/node": "^17.0.0",
|
|
51
50
|
"@types/supertest": "^2.0.11",
|
|
52
51
|
"@typescript-eslint/eslint-plugin": "^5.3.1",
|
|
53
52
|
"@typescript-eslint/parser": "^5.3.1",
|
|
@@ -55,9 +54,10 @@
|
|
|
55
54
|
"eslint-config-prettier": "^8.3.0",
|
|
56
55
|
"eslint-plugin-import": "^2.24.2",
|
|
57
56
|
"eslint-plugin-prettier": "^4.0.0",
|
|
58
|
-
"jest": "27.
|
|
57
|
+
"jest": "27.4.7",
|
|
59
58
|
"memorystream": "^0.3.1",
|
|
60
|
-
"pino
|
|
59
|
+
"pino": "^7.5.1",
|
|
60
|
+
"pino-http": "^6.4.0",
|
|
61
61
|
"prettier": "^2.3.2",
|
|
62
62
|
"reflect-metadata": "^0.1.13",
|
|
63
63
|
"rimraf": "^3.0.2",
|
|
@@ -86,6 +86,6 @@
|
|
|
86
86
|
"testEnvironment": "node"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
|
-
"pino-http": "^6.
|
|
89
|
+
"pino-http": "^6.4.0"
|
|
90
90
|
}
|
|
91
91
|
}
|
package/params.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { DestinationStream } from 'pino';
|
|
1
|
+
import { Options } from 'pino-http';
|
|
2
|
+
import { Logger, DestinationStream } from 'pino';
|
|
4
3
|
import { MiddlewareConfigProxy, ModuleMetadata } from '@nestjs/common/interfaces';
|
|
5
4
|
export declare type PassedLogger = {
|
|
6
|
-
logger:
|
|
5
|
+
logger: Logger;
|
|
7
6
|
};
|
|
8
7
|
export interface Params {
|
|
9
8
|
/**
|
|
10
9
|
* Optional parameters for `pino-http` module
|
|
11
10
|
* @see https://github.com/pinojs/pino-http#pinohttpopts-stream
|
|
12
11
|
*/
|
|
13
|
-
pinoHttp?:
|
|
12
|
+
pinoHttp?: Options | DestinationStream | [Options, DestinationStream];
|
|
14
13
|
/**
|
|
15
14
|
* Optional parameter for routing. It should implement interface of
|
|
16
15
|
* parameters of NestJS built-in `MiddlewareConfigProxy['forRoutes']`.
|