nestjs-pino 2.2.0 → 2.3.0
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/README.md +17 -4
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<a href="https://snyk.io/test/github/iamolegga/nestjs-pino">
|
|
16
16
|
<img alt="Snyk Vulnerabilities for npm package" src="https://img.shields.io/snyk/vulnerabilities/npm/nestjs-pino" />
|
|
17
17
|
</a>
|
|
18
|
-
<img alt="
|
|
18
|
+
<img alt="Libraries.io" src="https://img.shields.io/librariesio/release/npm/nestjs-pino">
|
|
19
19
|
<img alt="Dependabot" src="https://badgen.net/dependabot/iamolegga/nestjs-pino/?icon=dependabot">
|
|
20
20
|
<img alt="Supported platforms: Express & Fastify" src="https://img.shields.io/badge/platforms-Express%20%26%20Fastify-green" />
|
|
21
21
|
</p>
|
|
@@ -231,7 +231,9 @@ import { LoggerModule } from 'nestjs-pino';
|
|
|
231
231
|
name: 'add some name to every JSON line',
|
|
232
232
|
level: process.env.NODE_ENV !== 'production' ? 'debug' : 'info',
|
|
233
233
|
// install 'pino-pretty' package in order to use the following option
|
|
234
|
-
|
|
234
|
+
transport: process.env.NODE_ENV !== 'production'
|
|
235
|
+
? { target: 'pino-pretty' }
|
|
236
|
+
: {},
|
|
235
237
|
useLevelLabels: true,
|
|
236
238
|
// and all the others...
|
|
237
239
|
},
|
|
@@ -443,6 +445,19 @@ import { Logger } from 'nestjs-pino';
|
|
|
443
445
|
// ...
|
|
444
446
|
```
|
|
445
447
|
|
|
448
|
+
Note that for [standalone applications](https://docs.nestjs.com/standalone-applications), buffering has to be [flushed using app.flushLogs()](https://github.com/nestjs/nest/blob/24e6c821a0859448646fd88831f20e4c5ae50980/packages/core/nest-application-context.ts#L136) manually after custom logger is ready to be used by NestJS (refer to [this issue](https://github.com/iamolegga/nestjs-pino/issues/553) for more details):
|
|
449
|
+
|
|
450
|
+
```ts
|
|
451
|
+
// main.ts
|
|
452
|
+
import { Logger } from 'nestjs-pino';
|
|
453
|
+
|
|
454
|
+
// ...
|
|
455
|
+
const app = await NestFactory.createApplicationContext(AppModule, { bufferLogs: true });
|
|
456
|
+
app.useLogger(app.get(Logger));
|
|
457
|
+
app.flushLogs();
|
|
458
|
+
// ...
|
|
459
|
+
```
|
|
460
|
+
|
|
446
461
|
In all the other places you can use built-in `Logger`:
|
|
447
462
|
|
|
448
463
|
```ts
|
|
@@ -545,8 +560,6 @@ All the other cases are lead to either code duplication or unexpected behavior.
|
|
|
545
560
|
|
|
546
561
|
<h2 align="center">Do you use this library?<br/>Don't be shy to give it a star! ★</h2>
|
|
547
562
|
|
|
548
|
-
---
|
|
549
|
-
|
|
550
563
|
Also if you are into NestJS ecosystem you may be interested in one of my other libs:
|
|
551
564
|
|
|
552
565
|
[nestjs-pino](https://github.com/iamolegga/nestjs-pino)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nestjs-pino",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Pino logger for NestJS",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
"@types/node": "^16.0.0",
|
|
50
50
|
"@types/pino-http": "^5.4.3",
|
|
51
51
|
"@types/supertest": "^2.0.11",
|
|
52
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
53
|
-
"@typescript-eslint/parser": "^
|
|
54
|
-
"eslint": "^
|
|
52
|
+
"@typescript-eslint/eslint-plugin": "^5.3.1",
|
|
53
|
+
"@typescript-eslint/parser": "^5.3.1",
|
|
54
|
+
"eslint": "^8.2.0",
|
|
55
55
|
"eslint-config-prettier": "^8.3.0",
|
|
56
56
|
"eslint-plugin-import": "^2.24.2",
|
|
57
|
-
"eslint-plugin-prettier": "^
|
|
58
|
-
"jest": "27.1
|
|
57
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
58
|
+
"jest": "27.3.1",
|
|
59
59
|
"memorystream": "^0.3.1",
|
|
60
|
-
"pino-http": "^
|
|
60
|
+
"pino-http": "^6.0.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": "^
|
|
89
|
+
"pino-http": "^6.0.0"
|
|
90
90
|
}
|
|
91
91
|
}
|