@nestjs-labs/nestjs-pino-extra 1.0.1 → 1.1.1
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/LICENSE +21 -0
- package/README.md +86 -176
- package/dist/index.d.ts +3 -5
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -13
- package/dist/index.js.map +1 -1
- package/dist/module-option.d.ts +1 -0
- package/dist/module-option.d.ts.map +1 -0
- package/dist/module-option.js +3 -4
- package/dist/module-option.js.map +1 -1
- package/dist/nestjs-labs-nestjs-pino-extra-1.1.1.tgz +0 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +44 -29
- package/dist/formatters.d.ts +0 -6
- package/dist/formatters.js +0 -22
- package/dist/formatters.js.map +0 -1
- package/dist/options.d.ts +0 -2
- package/dist/options.js +0 -54
- package/dist/options.js.map +0 -1
- package/dist/serializers.d.ts +0 -2
- package/dist/serializers.js +0 -26
- package/dist/serializers.js.map +0 -1
- package/dist/streams.d.ts +0 -5
- package/dist/streams.js +0 -51
- package/dist/streams.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 nestjs-labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @nestjs-labs/nestjs-pino-extra
|
|
2
2
|
|
|
3
|
-
Enhanced nestjs-pino with OpenTelemetry
|
|
3
|
+
Enhanced nestjs-pino with OpenTelemetry, Loki, file rotation and enterprise features.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@nestjs-labs/nestjs-pino-extra)
|
|
6
|
+
[](https://github.com/nestjs-labs/nestjs-pino-extra/blob/main/LICENSE)
|
|
4
7
|
|
|
5
8
|
## Features
|
|
6
9
|
|
|
7
|
-
-
|
|
8
|
-
- 📊 **
|
|
9
|
-
- 📁 **File Rotation**:
|
|
10
|
-
-
|
|
11
|
-
- 🎨 **Pretty Logging**: Development-friendly colored output
|
|
10
|
+
- 🔍 **OpenTelemetry Integration**: Automatic span and trace ID injection
|
|
11
|
+
- 📊 **Loki Transport**: Send logs to Grafana Loki
|
|
12
|
+
- 📁 **File Rotation**: Automatic log file rotation with compression
|
|
13
|
+
- 🎨 **Pretty Logging**: Colored and formatted console output
|
|
12
14
|
- 🔒 **Security**: Automatic redaction of sensitive fields
|
|
13
|
-
-
|
|
14
|
-
- 📈 **Smart Log Levels**: Automatic log level based on HTTP status codes
|
|
15
|
+
- ⚡ **Performance**: High-performance logging with Pino
|
|
15
16
|
|
|
16
17
|
## Installation
|
|
17
18
|
|
|
18
19
|
```bash
|
|
19
|
-
|
|
20
|
-
# or
|
|
21
|
-
yarn add @nestjs-labs/nestjs-pino-extra
|
|
22
|
-
# or
|
|
23
|
-
pnpm add @nestjs-labs/nestjs-pino-extra
|
|
20
|
+
pnpm install @nestjs-labs/nestjs-pino-extra nestjs-pino @nestjs-labs/pino-http-extra @nestjs/config --save
|
|
24
21
|
```
|
|
25
22
|
|
|
23
|
+
### Peer Dependencies
|
|
24
|
+
|
|
25
|
+
- **@nestjs/config** (^4.0.0): Configuration management
|
|
26
|
+
- **nestjs-pino** (^4.4.0): NestJS Pino integration
|
|
27
|
+
- **@nestjs-labs/pino-http-extra** (^1.0.0): Enhanced pino-http functionality
|
|
28
|
+
|
|
26
29
|
## Quick Start
|
|
27
30
|
|
|
28
|
-
###
|
|
31
|
+
### Basic Usage
|
|
29
32
|
|
|
30
33
|
```typescript
|
|
31
34
|
import { Module } from '@nestjs/common';
|
|
32
|
-
import { ConfigModule } from '@nestjs/config';
|
|
33
|
-
import {
|
|
34
|
-
LoggerModule,
|
|
35
|
-
getLoggerModuleOptions,
|
|
36
|
-
} from '@nestjs-labs/nestjs-pino-extra';
|
|
35
|
+
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
36
|
+
import { LoggerModule } from '@nestjs-labs/nestjs-pino-extra';
|
|
37
37
|
|
|
38
38
|
@Module({
|
|
39
39
|
imports: [
|
|
40
40
|
ConfigModule.forRoot(),
|
|
41
41
|
LoggerModule.forRootAsync({
|
|
42
42
|
imports: [ConfigModule],
|
|
43
|
-
useFactory: (configService: ConfigService) =>
|
|
44
|
-
|
|
43
|
+
useFactory: (configService: ConfigService) =>
|
|
44
|
+
getNestjsPinoModuleOptions(configService),
|
|
45
45
|
inject: [ConfigService],
|
|
46
46
|
}),
|
|
47
47
|
],
|
|
@@ -49,199 +49,109 @@ import {
|
|
|
49
49
|
export class AppModule {}
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
###
|
|
52
|
+
### Environment Variables
|
|
53
53
|
|
|
54
|
-
```
|
|
54
|
+
```bash
|
|
55
55
|
# Required
|
|
56
56
|
OTLP_SERVICE_NAME=my-app
|
|
57
57
|
|
|
58
58
|
# Optional
|
|
59
59
|
LOG_LEVEL=info
|
|
60
60
|
LOG_FILE=/var/log/app.log
|
|
61
|
-
LOG_LOKI=http://
|
|
61
|
+
LOG_LOKI=http://loki:3100
|
|
62
|
+
OTEL_SPAN_ID_KEY=spanId
|
|
63
|
+
OTEL_TRACE_ID_KEY=traceId
|
|
62
64
|
```
|
|
63
65
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
### Environment Variables
|
|
67
|
-
|
|
68
|
-
| Variable | Default | Description |
|
|
69
|
-
| ------------------- | --------- | ------------------------------------------- |
|
|
70
|
-
| `OTLP_SERVICE_NAME` | `app` | Application name for log labels |
|
|
71
|
-
| `LOG_LEVEL` | `info` | Log level (error, warn, info, debug, trace) |
|
|
72
|
-
| `LOG_FILE` | - | File path for log rotation (optional) |
|
|
73
|
-
| `LOG_LOKI` | - | Loki server URL (optional) |
|
|
74
|
-
| `OTEL_SPAN_ID_KEY` | `spanId` | Key for OpenTelemetry span ID in logs |
|
|
75
|
-
| `OTEL_TRACE_ID_KEY` | `traceId` | Key for OpenTelemetry trace ID in logs |
|
|
76
|
-
|
|
77
|
-
### Features
|
|
78
|
-
|
|
79
|
-
#### OpenTelemetry Integration
|
|
80
|
-
|
|
81
|
-
Automatically injects trace and span IDs into logs when using OpenTelemetry:
|
|
66
|
+
### Advanced Configuration
|
|
82
67
|
|
|
83
68
|
```typescript
|
|
84
|
-
import {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
// {
|
|
88
|
-
// "level": "info",
|
|
89
|
-
// "message": "Request processed",
|
|
90
|
-
// "spanId": "abc123",
|
|
91
|
-
// "traceId": "def456",
|
|
92
|
-
// }
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
#### File Rotation
|
|
96
|
-
|
|
97
|
-
Configure log file rotation with automatic compression:
|
|
69
|
+
import { Module } from '@nestjs/common';
|
|
70
|
+
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
71
|
+
import { LoggerModule } from '@nestjs-labs/nestjs-pino-extra';
|
|
98
72
|
|
|
99
|
-
|
|
100
|
-
|
|
73
|
+
@Module({
|
|
74
|
+
imports: [
|
|
75
|
+
ConfigModule.forRoot(),
|
|
76
|
+
LoggerModule.forRootAsync({
|
|
77
|
+
imports: [ConfigModule],
|
|
78
|
+
useFactory: (configService: ConfigService) =>
|
|
79
|
+
getNestjsPinoModuleOptions(configService, {
|
|
80
|
+
exclude: [
|
|
81
|
+
{ method: 0, path: '/health' },
|
|
82
|
+
{ method: 0, path: '/metrics' },
|
|
83
|
+
],
|
|
84
|
+
}),
|
|
85
|
+
inject: [ConfigService],
|
|
86
|
+
}),
|
|
87
|
+
],
|
|
88
|
+
})
|
|
89
|
+
export class AppModule {}
|
|
101
90
|
```
|
|
102
91
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
- Rotated files: `app.log.1.gz`, `app.log.2.gz`, etc.
|
|
106
|
-
- 1GB file size limit
|
|
107
|
-
- Daily rotation
|
|
108
|
-
- Gzip compression
|
|
109
|
-
|
|
110
|
-
#### Loki Integration
|
|
92
|
+
## API Reference
|
|
111
93
|
|
|
112
|
-
|
|
94
|
+
### Functions
|
|
113
95
|
|
|
114
|
-
|
|
115
|
-
LOG_LOKI=http://localhost:3100
|
|
116
|
-
```
|
|
96
|
+
#### `getNestjsPinoModuleOptions(configService, overrides?)`
|
|
117
97
|
|
|
118
|
-
|
|
98
|
+
Get nestjs-pino module options with improved type safety and validation.
|
|
119
99
|
|
|
120
|
-
|
|
100
|
+
**Parameters:**
|
|
101
|
+
- `configService`: ConfigService - NestJS configuration service
|
|
102
|
+
- `overrides`: Params (optional) - Overrides for the module options
|
|
121
103
|
|
|
122
|
-
|
|
123
|
-
// Request headers will include:
|
|
124
|
-
// X-Request-Id: 550e8400-e29b-41d4-a716-446655440000
|
|
125
|
-
```
|
|
104
|
+
**Returns:** Params - Configured nestjs-pino module options
|
|
126
105
|
|
|
127
|
-
####
|
|
106
|
+
#### `getPinoHttpOption(level?, spanIdKey?, traceIdKey?)`
|
|
128
107
|
|
|
129
|
-
|
|
108
|
+
Get pino-http options with OpenTelemetry integration.
|
|
130
109
|
|
|
131
|
-
|
|
132
|
-
- `
|
|
133
|
-
- `
|
|
134
|
-
- `
|
|
110
|
+
**Parameters:**
|
|
111
|
+
- `level`: string (default: 'info') - Log level
|
|
112
|
+
- `spanIdKey`: string (default: 'spanId') - OpenTelemetry span ID key
|
|
113
|
+
- `traceIdKey`: string (default: 'traceId') - OpenTelemetry trace ID key
|
|
135
114
|
|
|
136
|
-
|
|
115
|
+
**Returns:** Options - Configured pino-http options
|
|
137
116
|
|
|
138
|
-
|
|
117
|
+
#### `getMultiDestinationStream(app, level?, filepath?, loki?)`
|
|
139
118
|
|
|
140
|
-
|
|
141
|
-
// These fields are automatically redacted:
|
|
142
|
-
// - password
|
|
143
|
-
// - reqBody.password
|
|
144
|
-
// - user.password
|
|
145
|
-
// - reqBody.user.password
|
|
146
|
-
```
|
|
119
|
+
Create multi-destination stream supporting pretty, file, and Loki outputs.
|
|
147
120
|
|
|
148
|
-
|
|
121
|
+
**Parameters:**
|
|
122
|
+
- `app`: string - Application name
|
|
123
|
+
- `level`: pino.Level (default: 'info') - Log level
|
|
124
|
+
- `filepath`: string (optional) - Log file path for rotation
|
|
125
|
+
- `loki`: string (optional) - Loki host URL
|
|
149
126
|
|
|
150
|
-
|
|
127
|
+
**Returns:** MultiStreamRes - Configured multi-stream
|
|
151
128
|
|
|
152
|
-
|
|
153
|
-
import { Module } from '@nestjs/common';
|
|
154
|
-
import { LoggerModule } from '@nestjs-labs/nestjs-pino-extra';
|
|
155
|
-
|
|
156
|
-
@Module({
|
|
157
|
-
imports: [
|
|
158
|
-
LoggerModule.forRoot({
|
|
159
|
-
pinoHttp: [
|
|
160
|
-
{
|
|
161
|
-
level: 'info',
|
|
162
|
-
customLogLevel: (req, res, err) => {
|
|
163
|
-
if (res.statusCode >= 400) return 'warn';
|
|
164
|
-
if (res.statusCode >= 500) return 'error';
|
|
165
|
-
return 'info';
|
|
166
|
-
},
|
|
167
|
-
redact: {
|
|
168
|
-
paths: ['password', 'token', 'secret'],
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
// Your custom stream configuration
|
|
172
|
-
],
|
|
173
|
-
exclude: [
|
|
174
|
-
{ method: RequestMethod.GET, path: '/health' },
|
|
175
|
-
{ method: RequestMethod.GET, path: '/metrics' },
|
|
176
|
-
],
|
|
177
|
-
}),
|
|
178
|
-
],
|
|
179
|
-
})
|
|
180
|
-
export class AppModule {}
|
|
181
|
-
```
|
|
129
|
+
## Examples
|
|
182
130
|
|
|
183
|
-
###
|
|
131
|
+
### Custom Logging
|
|
184
132
|
|
|
185
133
|
```typescript
|
|
186
134
|
import { Injectable, Logger } from '@nestjs/common';
|
|
187
135
|
|
|
188
136
|
@Injectable()
|
|
189
|
-
export class
|
|
190
|
-
private readonly logger = new Logger(
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
this.logger.log('
|
|
194
|
-
|
|
195
|
-
try {
|
|
196
|
-
// Your logic here
|
|
197
|
-
this.logger.log('User created successfully');
|
|
198
|
-
} catch (error) {
|
|
199
|
-
this.logger.error('Failed to create user', error.stack);
|
|
200
|
-
throw error;
|
|
201
|
-
}
|
|
137
|
+
export class AppService {
|
|
138
|
+
private readonly logger = new Logger(AppService.name);
|
|
139
|
+
|
|
140
|
+
getHello(): string {
|
|
141
|
+
this.logger.log('Hello World!');
|
|
142
|
+
return 'Hello World!';
|
|
202
143
|
}
|
|
203
144
|
}
|
|
204
145
|
```
|
|
205
146
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
### Build
|
|
209
|
-
|
|
210
|
-
```bash
|
|
211
|
-
npm run build
|
|
212
|
-
```
|
|
147
|
+
### HTTP Request Logging
|
|
213
148
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
## Dependencies
|
|
222
|
-
|
|
223
|
-
- `@nestjs/config` - Configuration management
|
|
224
|
-
- `@opentelemetry/api` - OpenTelemetry integration
|
|
225
|
-
- `pino` - Fast Node.js logger
|
|
226
|
-
- `pino-http` - HTTP request logging
|
|
227
|
-
- `pino-loki` - Loki transport
|
|
228
|
-
- `pino-pretty` - Pretty printing
|
|
229
|
-
- `rotating-file-stream` - File rotation
|
|
149
|
+
The middleware automatically logs HTTP requests with:
|
|
150
|
+
- Request ID generation
|
|
151
|
+
- Response time tracking
|
|
152
|
+
- Status code-based log levels
|
|
153
|
+
- Sensitive data redaction
|
|
230
154
|
|
|
231
155
|
## License
|
|
232
156
|
|
|
233
|
-
MIT
|
|
234
|
-
|
|
235
|
-
## Contributing
|
|
236
|
-
|
|
237
|
-
1. Fork the repository
|
|
238
|
-
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
239
|
-
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
240
|
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
241
|
-
5. Open a Pull Request
|
|
242
|
-
|
|
243
|
-
## Support
|
|
244
|
-
|
|
245
|
-
- 📖 [Documentation](https://github.com/nestjs-labs/nestjs-pino-extra)
|
|
246
|
-
- 🐛 [Issues](https://github.com/nestjs-labs/nestjs-pino-extra/issues)
|
|
247
|
-
- 💬 [Discussions](https://github.com/nestjs-labs/nestjs-pino-extra/discussions)
|
|
157
|
+
MIT
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export * from 'nestjs-pino';
|
|
2
|
-
export { getOtelFormatters } from './formatters.js';
|
|
3
1
|
export { getNestjsPinoModuleOptions } from './module-option.js';
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
|
|
2
|
+
export * from 'nestjs-pino';
|
|
3
|
+
export * from '@nestjs-labs/pino-http-extra';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAIhE,cAAc,aAAa,CAAC;AAI5B,cAAc,8BAA8B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -14,19 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
__exportStar(require("nestjs-pino"), exports);
|
|
19
|
-
var formatters_js_1 = require("./formatters.js");
|
|
20
|
-
Object.defineProperty(exports, "getOtelFormatters", { enumerable: true, get: function () { return formatters_js_1.getOtelFormatters; } });
|
|
17
|
+
exports.getNestjsPinoModuleOptions = void 0;
|
|
21
18
|
var module_option_js_1 = require("./module-option.js");
|
|
22
19
|
Object.defineProperty(exports, "getNestjsPinoModuleOptions", { enumerable: true, get: function () { return module_option_js_1.getNestjsPinoModuleOptions; } });
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var serializers_js_1 = require("./serializers.js");
|
|
26
|
-
Object.defineProperty(exports, "getSerializers", { enumerable: true, get: function () { return serializers_js_1.getSerializers; } });
|
|
27
|
-
var streams_js_1 = require("./streams.js");
|
|
28
|
-
Object.defineProperty(exports, "createFileStreamEntry", { enumerable: true, get: function () { return streams_js_1.createFileStreamEntry; } });
|
|
29
|
-
Object.defineProperty(exports, "createLokiStreamEntry", { enumerable: true, get: function () { return streams_js_1.createLokiStreamEntry; } });
|
|
30
|
-
Object.defineProperty(exports, "createPrettyStreamEntry", { enumerable: true, get: function () { return streams_js_1.createPrettyStreamEntry; } });
|
|
31
|
-
Object.defineProperty(exports, "getMultiDestinationStream", { enumerable: true, get: function () { return streams_js_1.getMultiDestinationStream; } });
|
|
20
|
+
__exportStar(require("nestjs-pino"), exports);
|
|
21
|
+
__exportStar(require("@nestjs-labs/pino-http-extra"), exports);
|
|
32
22
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAMA,uDAAgE;AAAvD,8HAAA,0BAA0B,OAAA;AAInC,8CAA4B;AAI5B,+DAA6C"}
|
package/dist/module-option.d.ts
CHANGED
|
@@ -14,3 +14,4 @@ export declare function getPinoHttpFromConfig(config: LogConfig): Params['pinoHt
|
|
|
14
14
|
export declare function getParamsFromConfig(config: LogConfig, overrides?: Params): Params;
|
|
15
15
|
export declare function getNestjsPinoModuleOptions(configService: ConfigService, overrides?: Params): Params;
|
|
16
16
|
export {};
|
|
17
|
+
//# sourceMappingURL=module-option.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-option.d.ts","sourceRoot":"","sources":["../src/module-option.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAO7B,UAAU,SAAS;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACnB;AAKD,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,aAAa,GAAG,SAAS,CAiCxE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,CAU3E;AAQD,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,SAAS,EACjB,SAAS,CAAC,EAAE,MAAM,GAChB,MAAM,CAQR;AAmBD,wBAAgB,0BAA0B,CACzC,aAAa,EAAE,aAAa,EAC5B,SAAS,GAAE,MAAW,GACpB,MAAM,CAIR"}
|
package/dist/module-option.js
CHANGED
|
@@ -4,8 +4,7 @@ exports.extractLogConfig = extractLogConfig;
|
|
|
4
4
|
exports.getPinoHttpFromConfig = getPinoHttpFromConfig;
|
|
5
5
|
exports.getParamsFromConfig = getParamsFromConfig;
|
|
6
6
|
exports.getNestjsPinoModuleOptions = getNestjsPinoModuleOptions;
|
|
7
|
-
const
|
|
8
|
-
const streams_js_1 = require("./streams.js");
|
|
7
|
+
const pino_http_extra_1 = require("@nestjs-labs/pino-http-extra");
|
|
9
8
|
function extractLogConfig(configService) {
|
|
10
9
|
const app = configService.get('OTLP_SERVICE_NAME') ?? 'app';
|
|
11
10
|
const level = configService.get('LOG_LEVEL') ?? 'info';
|
|
@@ -35,8 +34,8 @@ function extractLogConfig(configService) {
|
|
|
35
34
|
}
|
|
36
35
|
function getPinoHttpFromConfig(config) {
|
|
37
36
|
return [
|
|
38
|
-
(0,
|
|
39
|
-
(0,
|
|
37
|
+
(0, pino_http_extra_1.getPinoHttpOption)(config.level, config.spanIdKey, config.traceIdKey),
|
|
38
|
+
(0, pino_http_extra_1.getMultiDestinationStream)(config.app, config.level, config.filename, config.loki),
|
|
40
39
|
];
|
|
41
40
|
}
|
|
42
41
|
function getParamsFromConfig(config, overrides) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-option.js","sourceRoot":"","sources":["../src/module-option.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"module-option.js","sourceRoot":"","sources":["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