@nestjs-labs/nestjs-pino-extra 1.0.1 → 1.2.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/LICENSE +21 -0
- package/README.md +93 -180
- 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/tsconfig.tsbuildinfo +1 -1
- package/package.json +42 -27
- 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,50 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @nestjs-labs/nestjs-pino-extra
|
|
2
2
|
|
|
3
|
-
Enhanced nestjs-pino with OpenTelemetry
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- 🚀 **Easy Integration**: Simple setup with NestJS Pino
|
|
8
|
-
- 📊 **OpenTelemetry Support**: Automatic trace and span ID injection
|
|
9
|
-
- 📁 **File Rotation**: Configurable log file rotation with compression
|
|
10
|
-
- 🔍 **Loki Integration**: Direct logging to Grafana Loki
|
|
11
|
-
- 🎨 **Pretty Logging**: Development-friendly colored output
|
|
12
|
-
- 🔒 **Security**: Automatic redaction of sensitive fields
|
|
13
|
-
- 🏷️ **Request ID**: Automatic request ID generation and tracking
|
|
14
|
-
- 📈 **Smart Log Levels**: Automatic log level based on HTTP status codes
|
|
3
|
+
Enhanced nestjs-pino with OpenTelemetry, Loki, file rotation and enterprise features.
|
|
15
4
|
|
|
16
5
|
## Installation
|
|
17
6
|
|
|
7
|
+
This package has peer dependencies that must be installed:
|
|
8
|
+
|
|
18
9
|
```bash
|
|
19
|
-
|
|
20
|
-
# or
|
|
21
|
-
yarn add @nestjs-labs/nestjs-pino-extra
|
|
22
|
-
# or
|
|
23
|
-
pnpm add @nestjs-labs/nestjs-pino-extra
|
|
10
|
+
pnpm install @nestjs-labs/nestjs-pino-extra nestjs-pino @nestjs-labs/pino-http-extra @nestjs/config --save
|
|
24
11
|
```
|
|
25
12
|
|
|
13
|
+
### Peer Dependencies
|
|
14
|
+
|
|
15
|
+
This package requires the following peer dependencies:
|
|
16
|
+
|
|
17
|
+
- **@nestjs/config** (^4.0.0): Required for configuration management
|
|
18
|
+
- **nestjs-pino** (^4.4.0): Required for NestJS Pino integration
|
|
19
|
+
- **@nestjs-labs/pino-http-extra** (^1.0.0): Required for enhanced pino-http functionality
|
|
20
|
+
|
|
21
|
+
If any of these dependencies are missing, you'll get runtime errors when trying to use the package. Make sure to install all peer dependencies.
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
- 🔍 **OpenTelemetry Integration**: Automatic span and trace ID injection
|
|
26
|
+
- 📊 **Loki Transport**: Send logs to Grafana Loki
|
|
27
|
+
- 📁 **File Rotation**: Automatic log file rotation with compression
|
|
28
|
+
- 🎨 **Pretty Logging**: Colored and formatted console output
|
|
29
|
+
- 🔒 **Security**: Automatic redaction of sensitive fields
|
|
30
|
+
- ⚡ **Performance**: High-performance logging with Pino
|
|
31
|
+
|
|
26
32
|
## Quick Start
|
|
27
33
|
|
|
28
|
-
###
|
|
34
|
+
### Basic Usage
|
|
29
35
|
|
|
30
36
|
```typescript
|
|
31
37
|
import { Module } from '@nestjs/common';
|
|
32
|
-
import { ConfigModule } from '@nestjs/config';
|
|
33
|
-
import {
|
|
34
|
-
LoggerModule,
|
|
35
|
-
getLoggerModuleOptions,
|
|
36
|
-
} from '@nestjs-labs/nestjs-pino-extra';
|
|
38
|
+
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
39
|
+
import { LoggerModule } from '@nestjs-labs/nestjs-pino-extra';
|
|
37
40
|
|
|
38
41
|
@Module({
|
|
39
42
|
imports: [
|
|
40
43
|
ConfigModule.forRoot(),
|
|
41
44
|
LoggerModule.forRootAsync({
|
|
42
45
|
imports: [ConfigModule],
|
|
43
|
-
useFactory: (configService: ConfigService) =>
|
|
44
|
-
|
|
46
|
+
useFactory: (configService: ConfigService) =>
|
|
47
|
+
getNestjsPinoModuleOptions(configService),
|
|
45
48
|
inject: [ConfigService],
|
|
46
49
|
}),
|
|
47
50
|
],
|
|
@@ -49,199 +52,109 @@ import {
|
|
|
49
52
|
export class AppModule {}
|
|
50
53
|
```
|
|
51
54
|
|
|
52
|
-
###
|
|
55
|
+
### Environment Variables
|
|
53
56
|
|
|
54
|
-
```
|
|
57
|
+
```bash
|
|
55
58
|
# Required
|
|
56
59
|
OTLP_SERVICE_NAME=my-app
|
|
57
60
|
|
|
58
61
|
# Optional
|
|
59
62
|
LOG_LEVEL=info
|
|
60
63
|
LOG_FILE=/var/log/app.log
|
|
61
|
-
LOG_LOKI=http://
|
|
64
|
+
LOG_LOKI=http://loki:3100
|
|
65
|
+
OTEL_SPAN_ID_KEY=spanId
|
|
66
|
+
OTEL_TRACE_ID_KEY=traceId
|
|
62
67
|
```
|
|
63
68
|
|
|
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:
|
|
69
|
+
### Advanced Configuration
|
|
82
70
|
|
|
83
71
|
```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:
|
|
72
|
+
import { Module } from '@nestjs/common';
|
|
73
|
+
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
74
|
+
import { LoggerModule } from '@nestjs-labs/nestjs-pino-extra';
|
|
98
75
|
|
|
99
|
-
|
|
100
|
-
|
|
76
|
+
@Module({
|
|
77
|
+
imports: [
|
|
78
|
+
ConfigModule.forRoot(),
|
|
79
|
+
LoggerModule.forRootAsync({
|
|
80
|
+
imports: [ConfigModule],
|
|
81
|
+
useFactory: (configService: ConfigService) =>
|
|
82
|
+
getNestjsPinoModuleOptions(configService, {
|
|
83
|
+
exclude: [
|
|
84
|
+
{ method: 0, path: '/health' },
|
|
85
|
+
{ method: 0, path: '/metrics' },
|
|
86
|
+
],
|
|
87
|
+
}),
|
|
88
|
+
inject: [ConfigService],
|
|
89
|
+
}),
|
|
90
|
+
],
|
|
91
|
+
})
|
|
92
|
+
export class AppModule {}
|
|
101
93
|
```
|
|
102
94
|
|
|
103
|
-
|
|
95
|
+
## API Reference
|
|
104
96
|
|
|
105
|
-
|
|
106
|
-
- 1GB file size limit
|
|
107
|
-
- Daily rotation
|
|
108
|
-
- Gzip compression
|
|
97
|
+
### Functions
|
|
109
98
|
|
|
110
|
-
####
|
|
99
|
+
#### `getNestjsPinoModuleOptions(configService, overrides?)`
|
|
111
100
|
|
|
112
|
-
|
|
101
|
+
Get nestjs-pino module options with improved type safety and validation.
|
|
113
102
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
103
|
+
**Parameters:**
|
|
104
|
+
- `configService`: ConfigService - NestJS configuration service
|
|
105
|
+
- `overrides`: Params (optional) - Overrides for the module options
|
|
117
106
|
|
|
118
|
-
|
|
107
|
+
**Returns:** Params - Configured nestjs-pino module options
|
|
119
108
|
|
|
120
|
-
|
|
109
|
+
#### `getPinoHttpOption(level?, spanIdKey?, traceIdKey?)`
|
|
121
110
|
|
|
122
|
-
|
|
123
|
-
// Request headers will include:
|
|
124
|
-
// X-Request-Id: 550e8400-e29b-41d4-a716-446655440000
|
|
125
|
-
```
|
|
111
|
+
Get pino-http options with OpenTelemetry integration.
|
|
126
112
|
|
|
127
|
-
|
|
113
|
+
**Parameters:**
|
|
114
|
+
- `level`: string (default: 'info') - Log level
|
|
115
|
+
- `spanIdKey`: string (default: 'spanId') - OpenTelemetry span ID key
|
|
116
|
+
- `traceIdKey`: string (default: 'traceId') - OpenTelemetry trace ID key
|
|
128
117
|
|
|
129
|
-
|
|
118
|
+
**Returns:** Options - Configured pino-http options
|
|
130
119
|
|
|
131
|
-
|
|
132
|
-
- `5xx` responses → `error` level
|
|
133
|
-
- `3xx` responses → `silent` (no logging)
|
|
134
|
-
- `2xx` responses → `info` level
|
|
120
|
+
#### `getMultiDestinationStream(app, level?, filepath?, loki?)`
|
|
135
121
|
|
|
136
|
-
|
|
122
|
+
Create multi-destination stream supporting pretty, file, and Loki outputs.
|
|
137
123
|
|
|
138
|
-
|
|
124
|
+
**Parameters:**
|
|
125
|
+
- `app`: string - Application name
|
|
126
|
+
- `level`: pino.Level (default: 'info') - Log level
|
|
127
|
+
- `filepath`: string (optional) - Log file path for rotation
|
|
128
|
+
- `loki`: string (optional) - Loki host URL
|
|
139
129
|
|
|
140
|
-
|
|
141
|
-
// These fields are automatically redacted:
|
|
142
|
-
// - password
|
|
143
|
-
// - reqBody.password
|
|
144
|
-
// - user.password
|
|
145
|
-
// - reqBody.user.password
|
|
146
|
-
```
|
|
130
|
+
**Returns:** MultiStreamRes - Configured multi-stream
|
|
147
131
|
|
|
148
|
-
##
|
|
132
|
+
## Examples
|
|
149
133
|
|
|
150
|
-
### Custom
|
|
151
|
-
|
|
152
|
-
```typescript
|
|
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
|
-
```
|
|
182
|
-
|
|
183
|
-
### Using the Logger in Services
|
|
134
|
+
### Custom Logging
|
|
184
135
|
|
|
185
136
|
```typescript
|
|
186
137
|
import { Injectable, Logger } from '@nestjs/common';
|
|
187
138
|
|
|
188
139
|
@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
|
-
}
|
|
140
|
+
export class AppService {
|
|
141
|
+
private readonly logger = new Logger(AppService.name);
|
|
142
|
+
|
|
143
|
+
getHello(): string {
|
|
144
|
+
this.logger.log('Hello World!');
|
|
145
|
+
return 'Hello World!';
|
|
202
146
|
}
|
|
203
147
|
}
|
|
204
148
|
```
|
|
205
149
|
|
|
206
|
-
|
|
150
|
+
### HTTP Request Logging
|
|
207
151
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
### Lint
|
|
215
|
-
|
|
216
|
-
```bash
|
|
217
|
-
npm run lint
|
|
218
|
-
npm run lint:fix
|
|
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
|
|
152
|
+
The middleware automatically logs HTTP requests with:
|
|
153
|
+
- Request ID generation
|
|
154
|
+
- Response time tracking
|
|
155
|
+
- Status code-based log levels
|
|
156
|
+
- Sensitive data redaction
|
|
230
157
|
|
|
231
158
|
## License
|
|
232
159
|
|
|
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)
|
|
160
|
+
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":["../src/module-option.ts"],"names":[],"mappings":";;AAsBA,4CAiCC;AAED,sDAUC;AAQD,kDAWC;AAmBD,gEAOC;AA3GD,kEAA4F;AAiB5F,SAAgB,gBAAgB,CAAC,aAA4B;IAC5D,MAAM,GAAG,GAAG,aAAa,CAAC,GAAG,CAAS,mBAAmB,CAAC,IAAI,KAAK,CAAC;IACpE,MAAM,KAAK,GAAG,aAAa,CAAC,GAAG,CAAa,WAAW,CAAC,IAAI,MAAM,CAAC;IACnE,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAS,UAAU,CAAC,CAAC;IACvD,MAAM,IAAI,GAAG,aAAa,CAAC,GAAG,CAAS,UAAU,CAAC,CAAC;IACnD,MAAM,SAAS,GAAG,aAAa,CAAC,GAAG,CAAS,kBAAkB,CAAC,IAAI,QAAQ,CAAC;IAC5E,MAAM,UAAU,GACf,aAAa,CAAC,GAAG,CAAS,mBAAmB,CAAC,IAAI,SAAS,CAAC;IAG7D,MAAM,WAAW,GAAiB;QACjC,OAAO;QACP,OAAO;QACP,MAAM;QACN,MAAM;QACN,OAAO;QACP,OAAO;KACP,CAAC;IAEF,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CACd,sBAAsB,KAAK,qBAAqB,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACxE,CAAC;IACH,CAAC;IAED,OAAO;QACN,GAAG;QACH,QAAQ;QACR,KAAK;QACL,IAAI;QACJ,SAAS;QACT,UAAU;KACV,CAAC;AACH,CAAC;AAED,SAAgB,qBAAqB,CAAC,MAAiB;IACtD,OAAO;QACN,IAAA,mCAAiB,EAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,UAAU,CAAC;QACpE,IAAA,2CAAyB,EACxB,MAAM,CAAC,GAAG,EACV,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,QAAQ,EACf,MAAM,CAAC,IAAI,CACX;KACD,CAAC;AACH,CAAC;AAQD,SAAgB,mBAAmB,CAClC,MAAiB,EACjB,SAAkB;IAElB,MAAM,QAAQ,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,MAAM,GAAW;QACtB,QAAQ;QACR,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;KACzC,CAAC;IAEF,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AACzC,CAAC;AAmBD,SAAgB,0BAA0B,CACzC,aAA4B,EAC5B,YAAoB,EAAE;IAEtB,MAAM,MAAM,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAE/C,OAAO,mBAAmB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAC/C,CAAC"}
|