@infineit/winston-logger 1.0.32 → 1.0.33
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 +156 -22
- package/context/infrastructure/nestjs/contextModule.js +1 -10
- package/context/infrastructure/nestjs/contextModule.js.map +1 -1
- package/logger/infrastructure/forwarding/centralLogForwarder.js +1 -1
- package/logger/infrastructure/forwarding/centralLogForwarder.js.map +1 -1
- package/logger/infrastructure/forwarding/httpCentralLogForwarder.js +1 -1
- package/logger/infrastructure/forwarding/httpCentralLogForwarder.js.map +1 -1
- package/logger/infrastructure/forwarding/kafkaCentralLogForwarder.js.map +1 -1
- package/logger/infrastructure/nestjs/loggerModule.js +2 -3
- package/logger/infrastructure/nestjs/loggerModule.js.map +1 -1
- package/package.json +1 -1
- package/tsconfig.lib.tsbuildinfo +1 -1
package/README.md
CHANGED
|
@@ -49,6 +49,27 @@ This package requires the following peer dependencies (usually already installed
|
|
|
49
49
|
- `@nestjs/config` 4.2.0
|
|
50
50
|
- `@nestjs/core` 11.1.9
|
|
51
51
|
- `nestjs-cls` 5.0.1
|
|
52
|
+
- `uuid` (required for correlation ID generation in HTTP contexts)
|
|
53
|
+
|
|
54
|
+
### ⚠️ Critical Setup Requirement
|
|
55
|
+
|
|
56
|
+
**IMPORTANT:** `ClsModule.forRoot()` **MUST** be imported in your `AppModule` **BEFORE** `ContextModule`. This is required to avoid dependency resolution errors with `HttpAdapterHost`.
|
|
57
|
+
|
|
58
|
+
**Correct import order:**
|
|
59
|
+
```typescript
|
|
60
|
+
@Module({
|
|
61
|
+
imports: [
|
|
62
|
+
ConfigModule.forRoot({ isGlobal: true }),
|
|
63
|
+
ClsModule.forRoot({ ... }), // ✅ FIRST - Required
|
|
64
|
+
ContextModule, // ✅ THEN - Uses existing ClsModule
|
|
65
|
+
LoggerModule.forRoot(), // ✅ THEN - Configures logger
|
|
66
|
+
],
|
|
67
|
+
})
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**❌ Incorrect:** Importing `ContextModule` before `ClsModule` will cause `HttpAdapterHost` dependency errors.
|
|
71
|
+
|
|
72
|
+
**Note:** `ContextModule` does NOT import `ClsModule` internally. Applications must configure `ClsModule.forRoot()` themselves.
|
|
52
73
|
|
|
53
74
|
---
|
|
54
75
|
|
|
@@ -59,12 +80,26 @@ This package requires the following peer dependencies (usually already installed
|
|
|
59
80
|
```typescript
|
|
60
81
|
import { Module } from '@nestjs/common';
|
|
61
82
|
import { ConfigModule } from '@nestjs/config';
|
|
83
|
+
import { ClsModule } from 'nestjs-cls'; // REQUIRED: Must import ClsModule first
|
|
84
|
+
import { v4 as uuidv4 } from 'uuid'; // REQUIRED: For correlation ID generation
|
|
62
85
|
import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
63
86
|
|
|
64
87
|
@Module({
|
|
65
88
|
imports: [
|
|
66
89
|
ConfigModule.forRoot({ isGlobal: true }),
|
|
67
|
-
|
|
90
|
+
|
|
91
|
+
// ⚠️ CRITICAL: ClsModule MUST be imported BEFORE ContextModule
|
|
92
|
+
ClsModule.forRoot({
|
|
93
|
+
global: true,
|
|
94
|
+
middleware: {
|
|
95
|
+
mount: true, // Enable middleware for HTTP requests
|
|
96
|
+
generateId: true, // Auto-generate correlation ID
|
|
97
|
+
idGenerator: (req: Request) =>
|
|
98
|
+
(req.headers['x-correlation-id'] as string) || uuidv4(),
|
|
99
|
+
},
|
|
100
|
+
}),
|
|
101
|
+
|
|
102
|
+
ContextModule, // Required for CLS (correlation ID support) - uses existing ClsModule
|
|
68
103
|
LoggerModule.forRoot(), // Configure logger
|
|
69
104
|
],
|
|
70
105
|
})
|
|
@@ -181,8 +216,22 @@ const config: LoggerModuleConfig = {
|
|
|
181
216
|
// kafkaTopic: 'project-logs', // Kafka topic (required if transportType='kafka')
|
|
182
217
|
};
|
|
183
218
|
|
|
219
|
+
import { ClsModule } from 'nestjs-cls';
|
|
220
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
221
|
+
|
|
184
222
|
@Module({
|
|
185
223
|
imports: [
|
|
224
|
+
// ⚠️ CRITICAL: ClsModule MUST be imported BEFORE ContextModule
|
|
225
|
+
ClsModule.forRoot({
|
|
226
|
+
global: true,
|
|
227
|
+
middleware: {
|
|
228
|
+
mount: true,
|
|
229
|
+
generateId: true,
|
|
230
|
+
idGenerator: (req: Request) =>
|
|
231
|
+
(req.headers['x-correlation-id'] as string) || uuidv4(),
|
|
232
|
+
},
|
|
233
|
+
}),
|
|
234
|
+
ContextModule, // Uses existing ClsModule
|
|
186
235
|
LoggerModule.forRoot(config),
|
|
187
236
|
],
|
|
188
237
|
})
|
|
@@ -233,12 +282,26 @@ export default registerAs('logger', () => ({
|
|
|
233
282
|
```
|
|
234
283
|
|
|
235
284
|
```typescript
|
|
285
|
+
import { ClsModule } from 'nestjs-cls';
|
|
286
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
287
|
+
|
|
236
288
|
@Module({
|
|
237
289
|
imports: [
|
|
238
290
|
ConfigModule.forRoot({
|
|
239
291
|
isGlobal: true,
|
|
240
292
|
load: [loggerConfig],
|
|
241
293
|
}),
|
|
294
|
+
// ⚠️ CRITICAL: ClsModule MUST be imported BEFORE ContextModule
|
|
295
|
+
ClsModule.forRoot({
|
|
296
|
+
global: true,
|
|
297
|
+
middleware: {
|
|
298
|
+
mount: true,
|
|
299
|
+
generateId: true,
|
|
300
|
+
idGenerator: (req: Request) =>
|
|
301
|
+
(req.headers['x-correlation-id'] as string) || uuidv4(),
|
|
302
|
+
},
|
|
303
|
+
}),
|
|
304
|
+
ContextModule, // Uses existing ClsModule configuration
|
|
242
305
|
LoggerModule.forRoot(), // Will read from ConfigService
|
|
243
306
|
],
|
|
244
307
|
})
|
|
@@ -334,21 +397,26 @@ export class UserController {
|
|
|
334
397
|
}
|
|
335
398
|
```
|
|
336
399
|
|
|
337
|
-
**Important**: For HTTP services, you must configure CLS middleware manually
|
|
400
|
+
**Important**: For HTTP services, you must configure CLS middleware manually. **ClsModule MUST be imported BEFORE ContextModule:**
|
|
338
401
|
|
|
339
402
|
```typescript
|
|
340
403
|
import { ClsModule } from 'nestjs-cls';
|
|
404
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
405
|
+
import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
341
406
|
|
|
342
407
|
@Module({
|
|
343
408
|
imports: [
|
|
409
|
+
// ⚠️ CRITICAL: ClsModule MUST be imported FIRST
|
|
344
410
|
ClsModule.forRoot({
|
|
411
|
+
global: true,
|
|
345
412
|
middleware: {
|
|
346
413
|
mount: true, // Enable middleware
|
|
347
414
|
generateId: true, // Auto-generate correlation ID
|
|
348
|
-
idGenerator: (req: Request) =>
|
|
415
|
+
idGenerator: (req: Request) =>
|
|
416
|
+
(req.headers['x-correlation-id'] as string) || uuidv4(),
|
|
349
417
|
},
|
|
350
418
|
}),
|
|
351
|
-
ContextModule, // Provides CLS service
|
|
419
|
+
ContextModule, // Provides CLS service - uses existing ClsModule
|
|
352
420
|
LoggerModule.forRoot(),
|
|
353
421
|
],
|
|
354
422
|
})
|
|
@@ -541,8 +609,10 @@ export class KafkaTransport implements LoggerTransport {
|
|
|
541
609
|
### Registering Custom Transports
|
|
542
610
|
|
|
543
611
|
```typescript
|
|
544
|
-
import { Provider } from '@nestjs/common';
|
|
545
|
-
import {
|
|
612
|
+
import { Provider, Module } from '@nestjs/common';
|
|
613
|
+
import { ClsModule } from 'nestjs-cls';
|
|
614
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
615
|
+
import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
546
616
|
import { KafkaTransport } from './kafka-transport';
|
|
547
617
|
|
|
548
618
|
const customTransports: Provider[] = [
|
|
@@ -554,6 +624,17 @@ const customTransports: Provider[] = [
|
|
|
554
624
|
|
|
555
625
|
@Module({
|
|
556
626
|
imports: [
|
|
627
|
+
// ⚠️ CRITICAL: ClsModule MUST be imported BEFORE ContextModule
|
|
628
|
+
ClsModule.forRoot({
|
|
629
|
+
global: true,
|
|
630
|
+
middleware: {
|
|
631
|
+
mount: true,
|
|
632
|
+
generateId: true,
|
|
633
|
+
idGenerator: (req: Request) =>
|
|
634
|
+
(req.headers['x-correlation-id'] as string) || uuidv4(),
|
|
635
|
+
},
|
|
636
|
+
}),
|
|
637
|
+
ContextModule, // Uses existing ClsModule
|
|
557
638
|
LoggerModule.forRoot(config, customTransports),
|
|
558
639
|
],
|
|
559
640
|
})
|
|
@@ -598,8 +679,23 @@ LOGGER_HTTP_ENDPOINT=https://logging-service.example.com/api/logs
|
|
|
598
679
|
|
|
599
680
|
**Via Module Configuration:**
|
|
600
681
|
```typescript
|
|
682
|
+
import { ClsModule } from 'nestjs-cls';
|
|
683
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
684
|
+
import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
685
|
+
|
|
601
686
|
@Module({
|
|
602
687
|
imports: [
|
|
688
|
+
// ⚠️ CRITICAL: ClsModule MUST be imported BEFORE ContextModule
|
|
689
|
+
ClsModule.forRoot({
|
|
690
|
+
global: true,
|
|
691
|
+
middleware: {
|
|
692
|
+
mount: true,
|
|
693
|
+
generateId: true,
|
|
694
|
+
idGenerator: (req: Request) =>
|
|
695
|
+
(req.headers['x-correlation-id'] as string) || uuidv4(),
|
|
696
|
+
},
|
|
697
|
+
}),
|
|
698
|
+
ContextModule, // Uses existing ClsModule
|
|
603
699
|
LoggerModule.forRoot({
|
|
604
700
|
// ... existing config
|
|
605
701
|
forwardToCentral: true,
|
|
@@ -876,31 +972,36 @@ Correlation ID is **optional** - `undefined` is valid:
|
|
|
876
972
|
|
|
877
973
|
### HTTP Context Setup
|
|
878
974
|
|
|
879
|
-
For HTTP services, configure CLS middleware
|
|
975
|
+
For HTTP services, configure CLS middleware. **ClsModule MUST be imported BEFORE ContextModule:**
|
|
880
976
|
|
|
881
977
|
```typescript
|
|
882
978
|
import { ClsModule } from 'nestjs-cls';
|
|
883
979
|
import { v4 as uuidv4 } from 'uuid';
|
|
980
|
+
import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
884
981
|
|
|
885
982
|
@Module({
|
|
886
983
|
imports: [
|
|
984
|
+
// ⚠️ CRITICAL: ClsModule MUST be imported FIRST
|
|
887
985
|
ClsModule.forRoot({
|
|
986
|
+
global: true,
|
|
888
987
|
middleware: {
|
|
889
988
|
mount: true,
|
|
890
989
|
generateId: true,
|
|
891
990
|
idGenerator: (req: Request) => {
|
|
892
991
|
// Use existing correlation ID from header, or generate new one
|
|
893
|
-
return req.headers['x-correlation-id'] as string || uuidv4();
|
|
992
|
+
return (req.headers['x-correlation-id'] as string) || uuidv4();
|
|
894
993
|
},
|
|
895
994
|
},
|
|
896
995
|
}),
|
|
897
|
-
ContextModule, //
|
|
996
|
+
ContextModule, // Uses existing ClsModule configuration
|
|
898
997
|
LoggerModule.forRoot(),
|
|
899
998
|
],
|
|
900
999
|
})
|
|
901
1000
|
export class AppModule {}
|
|
902
1001
|
```
|
|
903
1002
|
|
|
1003
|
+
**Important:** The import order is critical. `ClsModule.forRoot()` must be imported before `ContextModule` to avoid `HttpAdapterHost` dependency resolution errors.
|
|
1004
|
+
|
|
904
1005
|
### CLS Context Boundaries and Edge Cases
|
|
905
1006
|
|
|
906
1007
|
#### Async Context Propagation
|
|
@@ -1070,9 +1171,12 @@ if (correlationId && validateCorrelationId(correlationId)) {
|
|
|
1070
1171
|
#### Validation in HTTP Middleware
|
|
1071
1172
|
|
|
1072
1173
|
```typescript
|
|
1174
|
+
import { ClsModule } from 'nestjs-cls';
|
|
1073
1175
|
import { v4 as uuidv4, validate as uuidValidate } from 'uuid';
|
|
1074
1176
|
|
|
1177
|
+
// ⚠️ CRITICAL: ClsModule MUST be imported BEFORE ContextModule in AppModule
|
|
1075
1178
|
ClsModule.forRoot({
|
|
1179
|
+
global: true,
|
|
1076
1180
|
middleware: {
|
|
1077
1181
|
mount: true,
|
|
1078
1182
|
generateId: true,
|
|
@@ -1127,7 +1231,9 @@ import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
|
1127
1231
|
@Module({
|
|
1128
1232
|
imports: [
|
|
1129
1233
|
ConfigModule.forRoot({ isGlobal: true }),
|
|
1234
|
+
// ⚠️ CRITICAL: ClsModule MUST be imported FIRST
|
|
1130
1235
|
ClsModule.forRoot({
|
|
1236
|
+
global: true,
|
|
1131
1237
|
middleware: {
|
|
1132
1238
|
mount: true,
|
|
1133
1239
|
generateId: true,
|
|
@@ -1137,7 +1243,7 @@ import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
|
1137
1243
|
},
|
|
1138
1244
|
},
|
|
1139
1245
|
}),
|
|
1140
|
-
ContextModule,
|
|
1246
|
+
ContextModule, // Uses existing ClsModule configuration
|
|
1141
1247
|
LoggerModule.forRoot({
|
|
1142
1248
|
nodeEnv: process.env.NODE_ENV,
|
|
1143
1249
|
organization: 'sales',
|
|
@@ -1573,19 +1679,25 @@ async createInvoice(@Body() data: CreateInvoiceDto, @Headers() headers: Headers)
|
|
|
1573
1679
|
**4. Common Service (app.module.ts):**
|
|
1574
1680
|
|
|
1575
1681
|
```typescript
|
|
1682
|
+
import { ClsModule } from 'nestjs-cls';
|
|
1683
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
1684
|
+
import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
1685
|
+
|
|
1576
1686
|
@Module({
|
|
1577
1687
|
imports: [
|
|
1688
|
+
// ⚠️ CRITICAL: ClsModule MUST be imported FIRST
|
|
1578
1689
|
ClsModule.forRoot({
|
|
1690
|
+
global: true,
|
|
1579
1691
|
middleware: {
|
|
1580
1692
|
mount: true,
|
|
1581
1693
|
generateId: true,
|
|
1582
1694
|
idGenerator: (req: Request) => {
|
|
1583
1695
|
// Extract from header (propagated from Document Service)
|
|
1584
|
-
return req.headers['x-correlation-id'] as string || uuidv4();
|
|
1696
|
+
return (req.headers['x-correlation-id'] as string) || uuidv4();
|
|
1585
1697
|
},
|
|
1586
1698
|
},
|
|
1587
1699
|
}),
|
|
1588
|
-
ContextModule,
|
|
1700
|
+
ContextModule, // Uses existing ClsModule configuration
|
|
1589
1701
|
LoggerModule.forRoot(),
|
|
1590
1702
|
],
|
|
1591
1703
|
})
|
|
@@ -1750,11 +1862,23 @@ bootstrap();
|
|
|
1750
1862
|
```typescript
|
|
1751
1863
|
// ✅ CORRECT: Use LoggerService injection
|
|
1752
1864
|
import { NestFactory } from '@nestjs/core';
|
|
1865
|
+
import { ClsModule } from 'nestjs-cls';
|
|
1866
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
1753
1867
|
import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
1754
1868
|
|
|
1755
1869
|
@Module({
|
|
1756
1870
|
imports: [
|
|
1757
|
-
ContextModule
|
|
1871
|
+
// ⚠️ CRITICAL: ClsModule MUST be imported BEFORE ContextModule
|
|
1872
|
+
ClsModule.forRoot({
|
|
1873
|
+
global: true,
|
|
1874
|
+
middleware: {
|
|
1875
|
+
mount: true,
|
|
1876
|
+
generateId: true,
|
|
1877
|
+
idGenerator: (req: Request) =>
|
|
1878
|
+
(req.headers['x-correlation-id'] as string) || uuidv4(),
|
|
1879
|
+
},
|
|
1880
|
+
}),
|
|
1881
|
+
ContextModule, // Uses existing ClsModule
|
|
1758
1882
|
LoggerModule.forRoot(),
|
|
1759
1883
|
],
|
|
1760
1884
|
})
|
|
@@ -1913,14 +2037,22 @@ async function bootstrap() {
|
|
|
1913
2037
|
```typescript
|
|
1914
2038
|
import { NestFactory } from '@nestjs/core';
|
|
1915
2039
|
import { ClsModule } from 'nestjs-cls';
|
|
2040
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
1916
2041
|
import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
1917
2042
|
|
|
1918
2043
|
@Module({
|
|
1919
2044
|
imports: [
|
|
2045
|
+
// ⚠️ CRITICAL: ClsModule MUST be imported FIRST
|
|
1920
2046
|
ClsModule.forRoot({
|
|
1921
|
-
|
|
2047
|
+
global: true,
|
|
2048
|
+
middleware: {
|
|
2049
|
+
mount: true,
|
|
2050
|
+
generateId: true,
|
|
2051
|
+
idGenerator: (req: Request) =>
|
|
2052
|
+
(req.headers['x-correlation-id'] as string) || uuidv4(),
|
|
2053
|
+
},
|
|
1922
2054
|
}),
|
|
1923
|
-
ContextModule, // ✅
|
|
2055
|
+
ContextModule, // ✅ Uses existing ClsModule
|
|
1924
2056
|
LoggerModule.forRoot(), // ✅ Add
|
|
1925
2057
|
],
|
|
1926
2058
|
})
|
|
@@ -1938,10 +2070,11 @@ async function bootstrap() {
|
|
|
1938
2070
|
|
|
1939
2071
|
If you encounter issues during migration:
|
|
1940
2072
|
|
|
1941
|
-
1. **Check module imports**: Ensure `
|
|
1942
|
-
2. **Check CLS setup**: For HTTP services, ensure `ClsModule` is configured
|
|
1943
|
-
3. **Check
|
|
1944
|
-
4. **
|
|
2073
|
+
1. **Check module imports**: Ensure `ClsModule.forRoot()` is imported **BEFORE** `ContextModule`, then `LoggerModule.forRoot()` in your `AppModule`
|
|
2074
|
+
2. **Check CLS setup**: For HTTP services, ensure `ClsModule.forRoot()` is configured with `middleware: { mount: true, generateId: true }`
|
|
2075
|
+
3. **Check import order**: `ClsModule` must come before `ContextModule` to avoid `HttpAdapterHost` dependency errors
|
|
2076
|
+
4. **Check injection**: Ensure `LoggerService` is injected via constructor
|
|
2077
|
+
5. **Review examples**: See the "Usage in Different Contexts" section above
|
|
1945
2078
|
|
|
1946
2079
|
---
|
|
1947
2080
|
|
|
@@ -2109,15 +2242,17 @@ import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
|
2109
2242
|
@Module({
|
|
2110
2243
|
imports: [
|
|
2111
2244
|
ConfigModule.forRoot({ isGlobal: true }),
|
|
2245
|
+
// ⚠️ CRITICAL: ClsModule MUST be imported FIRST
|
|
2112
2246
|
ClsModule.forRoot({
|
|
2247
|
+
global: true,
|
|
2113
2248
|
middleware: {
|
|
2114
2249
|
mount: true,
|
|
2115
2250
|
generateId: true,
|
|
2116
2251
|
idGenerator: (req: Request) =>
|
|
2117
|
-
req.headers['x-correlation-id'] as string || uuidv4(),
|
|
2252
|
+
(req.headers['x-correlation-id'] as string) || uuidv4(),
|
|
2118
2253
|
},
|
|
2119
2254
|
}),
|
|
2120
|
-
ContextModule,
|
|
2255
|
+
ContextModule, // Uses existing ClsModule configuration
|
|
2121
2256
|
LoggerModule.forRoot({
|
|
2122
2257
|
nodeEnv: process.env.NODE_ENV,
|
|
2123
2258
|
organization: 'my-org',
|
|
@@ -2127,7 +2262,6 @@ import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
|
2127
2262
|
],
|
|
2128
2263
|
})
|
|
2129
2264
|
export class AppModule {}
|
|
2130
|
-
```
|
|
2131
2265
|
|
|
2132
2266
|
```typescript
|
|
2133
2267
|
import { Injectable } from '@nestjs/common';
|
|
@@ -11,7 +11,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ContextModule = void 0;
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
|
-
const nestjs_cls_1 = require("nestjs-cls");
|
|
15
14
|
const contextStorageService_1 = require("../../../context/domain/interfaces/contextStorageService");
|
|
16
15
|
const nestjsClsContextStorageService_1 = __importDefault(require("../../../context/infrastructure/nestjs-cls/nestjsClsContextStorageService"));
|
|
17
16
|
let ContextModule = class ContextModule {
|
|
@@ -20,15 +19,7 @@ exports.ContextModule = ContextModule;
|
|
|
20
19
|
exports.ContextModule = ContextModule = __decorate([
|
|
21
20
|
(0, common_1.Global)(),
|
|
22
21
|
(0, common_1.Module)({
|
|
23
|
-
imports: [
|
|
24
|
-
nestjs_cls_1.ClsModule.forRoot({
|
|
25
|
-
global: true,
|
|
26
|
-
middleware: {
|
|
27
|
-
mount: false,
|
|
28
|
-
generateId: false,
|
|
29
|
-
},
|
|
30
|
-
}),
|
|
31
|
-
],
|
|
22
|
+
imports: [],
|
|
32
23
|
controllers: [],
|
|
33
24
|
providers: [
|
|
34
25
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextModule.js","sourceRoot":"","sources":["../../../../../libs/src/context/infrastructure/nestjs/contextModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAgD;
|
|
1
|
+
{"version":3,"file":"contextModule.js","sourceRoot":"","sources":["../../../../../libs/src/context/infrastructure/nestjs/contextModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAgD;AAIhD,oGAAoG;AACpG,+IAAuH;AA2ChH,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,sCAAa;wBAAb,aAAa;IAhBzB,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACJ,OAAO,EAAE,EAIR;QACD,WAAW,EAAE,EAAE;QACf,SAAS,EAAE;YACP;gBACI,OAAO,EAAE,gDAAwB;gBACjC,QAAQ,EAAE,wCAA8B;aAC3C;SACJ;QACD,OAAO,EAAE,CAAC,gDAAwB,CAAC;KACtC,CAAC;GACW,aAAa,CAAG"}
|
|
@@ -15,8 +15,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.CentralLogForwarder = exports.CentralLogForwarderKey = exports.KafkaProducerKey = void 0;
|
|
16
16
|
const common_1 = require("@nestjs/common");
|
|
17
17
|
const config_1 = require("@nestjs/config");
|
|
18
|
-
const kafkaCentralLogForwarder_1 = require("./kafkaCentralLogForwarder");
|
|
19
18
|
const httpCentralLogForwarder_1 = require("./httpCentralLogForwarder");
|
|
19
|
+
const kafkaCentralLogForwarder_1 = require("./kafkaCentralLogForwarder");
|
|
20
20
|
exports.KafkaProducerKey = Symbol('KafkaProducer');
|
|
21
21
|
exports.CentralLogForwarderKey = Symbol('CentralLogForwarder');
|
|
22
22
|
let CentralLogForwarder = class CentralLogForwarder {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"centralLogForwarder.js","sourceRoot":"","sources":["../../../../../libs/src/logger/infrastructure/forwarding/centralLogForwarder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA8D;AAC9D,2CAA+C;
|
|
1
|
+
{"version":3,"file":"centralLogForwarder.js","sourceRoot":"","sources":["../../../../../libs/src/logger/infrastructure/forwarding/centralLogForwarder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA8D;AAC9D,2CAA+C;AAI/C,uEAAoE;AACpE,yEAAsE;AAMzD,QAAA,gBAAgB,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAK3C,QAAA,sBAAsB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAoB7D,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAIP;IAC6B;IAJ1C,SAAS,GAAgC,IAAI,CAAC;IAEtD,YACqB,aAA4B,EACC,aAAmB;QADhD,kBAAa,GAAb,aAAa,CAAe;QACC,kBAAa,GAAb,aAAa,CAAM;QAEjE,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAQ,CAAC;YACxE,MAAM,gBAAgB,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;YACrE,MAAM,aAAa,GAAG,MAAM,EAAE,aAAa,CAAC;YAE5C,IAAI,gBAAgB,EAAE,CAAC;gBACnB,IAAI,aAAa,KAAK,OAAO,EAAE,CAAC;oBAC5B,MAAM,UAAU,GAAG,MAAM,EAAE,UAAU,CAAC;oBACtC,IAAI,UAAU,EAAE,CAAC;wBACb,IAAI,CAAC,SAAS,GAAG,IAAI,mDAAwB,CACzC,UAAU,EACV,IAAI,CAAC,aAAa,CACrB,CAAC;oBACN,CAAC;gBACL,CAAC;qBAAM,IAAI,aAAa,KAAK,MAAM,EAAE,CAAC;oBAClC,MAAM,YAAY,GAAG,MAAM,EAAE,YAAY,CAAC;oBAC1C,IAAI,YAAY,EAAE,CAAC;wBACf,IAAI,CAAC,SAAS,GAAG,IAAI,iDAAuB,CAAC,YAAY,CAAC,CAAC;oBAC/D,CAAC;gBACL,CAAC;YACL,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAEb,OAAO,CAAC,KAAK,CAAC,uDAAuD,EAAE,KAAK,CAAC,CAAC;YAC9E,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAC1B,CAAC;IACL,CAAC;IAMM,OAAO,CAAC,aAA4B;QACvC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YAClB,OAAO;QACX,CAAC;QAED,IAAI,CAAC;YACD,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAC1C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAEb,OAAO,CAAC,KAAK,CAAC,gDAAgD,EAAE,KAAK,CAAC,CAAC;QAC3E,CAAC;IACL,CAAC;IAEO,YAAY,CAAC,KAAmC;QACpD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACtB,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;YAC7B,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,OAAO,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,GAAG,CAAC;IAC7C,CAAC;CACJ,CAAA;AA7DY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IAMJ,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,eAAM,EAAC,wBAAgB,CAAC,CAAA;qCADL,sBAAa;GAJxC,mBAAmB,CA6D/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpCentralLogForwarder.js","sourceRoot":"","sources":["../../../../../libs/src/logger/infrastructure/forwarding/httpCentralLogForwarder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"httpCentralLogForwarder.js","sourceRoot":"","sources":["../../../../../libs/src/logger/infrastructure/forwarding/httpCentralLogForwarder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,6CAA+B;AAC/B,6BAA0B;AAW1B,MAAa,uBAAuB;IACf,QAAQ,CAAS;IACjB,GAAG,CAAM;IAE1B,YAAY,QAAgB;QACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC;YACD,IAAI,CAAC,GAAG,GAAG,IAAI,SAAG,CAAC,QAAQ,CAAC,CAAC;QACjC,CAAC;QAAC,MAAM,CAAC;YAEL,MAAM,IAAI,KAAK,CAAC,0BAA0B,QAAQ,EAAE,CAAC,CAAC;QAC1D,CAAC;IACL,CAAC;IAMM,OAAO,CAAC,aAA4B;QACvC,IAAI,CAAC;YACD,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;YACjD,MAAM,OAAO,GAAG;gBACZ,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ;gBAC3B,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;gBAClE,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ;gBACvB,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACL,cAAc,EAAE,kBAAkB;oBAClC,gBAAgB,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC;oBAE/C,GAAG,CAAC,aAAa,CAAC,aAAa;wBAC3B,CAAC,CAAC,EAAE,kBAAkB,EAAE,aAAa,CAAC,aAAa,EAAE;wBACrD,CAAC,CAAC,EAAE,CAAC;iBACZ;aACJ,CAAC;YAEF,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;YAG7D,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;gBAExC,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;gBACzB,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;YAEH,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;gBAEtB,OAAO,CAAC,KAAK,CAAC,4CAA4C,EAAE,KAAK,CAAC,CAAC;YACvE,CAAC,CAAC,CAAC;YAGH,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE;gBACtB,GAAG,CAAC,OAAO,EAAE,CAAC;YAClB,CAAC,CAAC,CAAC;YAEH,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YACtB,GAAG,CAAC,GAAG,EAAE,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAEb,OAAO,CAAC,KAAK,CAAC,oDAAoD,EAAE,KAAK,CAAC,CAAC;QAC/E,CAAC;IACL,CAAC;CACJ;AA9DD,0DA8DC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kafkaCentralLogForwarder.js","sourceRoot":"","sources":["../../../../../libs/src/logger/infrastructure/forwarding/kafkaCentralLogForwarder.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"kafkaCentralLogForwarder.js","sourceRoot":"","sources":["../../../../../libs/src/logger/infrastructure/forwarding/kafkaCentralLogForwarder.ts"],"names":[],"mappings":";;;AAaA,MAAa,wBAAwB;IAChB,KAAK,CAAS;IACvB,aAAa,GA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ACJ;AAhED,4DAgEC"}
|
|
@@ -16,12 +16,12 @@ const config_1 = require("@nestjs/config");
|
|
|
16
16
|
const logger_1 = require("../../../logger/domain/logger");
|
|
17
17
|
const loggerService_1 = __importDefault(require("../../../logger/domain/loggerService"));
|
|
18
18
|
const loggerTransport_1 = require("../../../logger/domain/loggerTransport");
|
|
19
|
+
const centralLogForwarder_1 = require("../../../logger/infrastructure/forwarding/centralLogForwarder");
|
|
19
20
|
const nestjsLoggerServiceAdapter_1 = __importDefault(require("../../../logger/infrastructure/nestjs/nestjsLoggerServiceAdapter"));
|
|
20
21
|
const consoleTransport_1 = __importDefault(require("../../../logger/infrastructure/winston/transports/consoleTransport"));
|
|
21
22
|
const fileTransport_1 = __importDefault(require("../../../logger/infrastructure/winston/transports/fileTransport"));
|
|
22
23
|
const slackTransport_1 = __importDefault(require("../../../logger/infrastructure/winston/transports/slackTransport"));
|
|
23
24
|
const winstonTransportAdapter_1 = require("../../../logger/infrastructure/winston/winstonTransportAdapter");
|
|
24
|
-
const centralLogForwarder_1 = require("../../../logger/infrastructure/forwarding/centralLogForwarder");
|
|
25
25
|
let LoggerModule = LoggerModule_1 = class LoggerModule {
|
|
26
26
|
static forRoot(config, additionalTransports) {
|
|
27
27
|
const transportProviders = [
|
|
@@ -72,8 +72,7 @@ let LoggerModule = LoggerModule_1 = class LoggerModule {
|
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
-
const loggerConfig = config ||
|
|
76
|
-
{};
|
|
75
|
+
const loggerConfig = config || {};
|
|
77
76
|
const forwardToCentralConfig = loggerConfig.forwardToCentral;
|
|
78
77
|
const forwardToCentral = forwardToCentralConfig !== undefined
|
|
79
78
|
? forwardToCentralConfig === 'true' || forwardToCentralConfig === true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loggerModule.js","sourceRoot":"","sources":["../../../../../libs/src/logger/infrastructure/nestjs/loggerModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAyE;AACzE,2CAA+C;AAI/C,0DAAkE;AAClE,yFAAiE;AACjE,4EAA6F;AAC7F,kIAA0G;AAC1G,0HAAkG;AAClG,oHAA4F;AAC5F,sHAA8F;AAC9F,4GAGwE;
|
|
1
|
+
{"version":3,"file":"loggerModule.js","sourceRoot":"","sources":["../../../../../libs/src/logger/infrastructure/nestjs/loggerModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAyE;AACzE,2CAA+C;AAI/C,0DAAkE;AAClE,yFAAiE;AACjE,4EAA6F;AAC7F,uGAGuE;AACvE,kIAA0G;AAC1G,0HAAkG;AAClG,oHAA4F;AAC5F,sHAA8F;AAC9F,4GAGwE;AAkBjE,IAAM,YAAY,oBAAlB,MAAM,YAAY;IACrB,MAAM,CAAC,OAAO,CAAC,MAA2B,EAAE,oBAAiC;QAEzE,MAAM,kBAAkB,GAAe;YAEnC;gBACI,OAAO,EAAE,8DAAoC;gBAC7C,UAAU,EAAE,CAAC,aAA4B,EAAE,EAAE;oBACzC,MAAM,UAAU,GAAwB,EAAE,CAAC;oBAG3C,MAAM,YAAY,GACd,MAAM;wBACL,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAoC;wBAC/D,EAAE,CAAC;oBASP,MAAM,YAAY,GAAG,YAAY,CAAC,OAAO,KAAK,YAAY,CAAC;oBAC3D,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,KAAK,SAAS,CAAC;oBACrD,MAAM,eAAe,GAAG,YAAY,CAAC,aAAa,CAAC;oBAEnD,MAAM,kBAAkB,GAAG,YAAY,CAAC,aAAa,CAAC;oBACtD,MAAM,YAAY,GACd,kBAAkB,KAAK,SAAS;wBAC5B,CAAC,CAAC,kBAAkB,KAAK,MAAM,IAAI,kBAAkB,KAAK,IAAI;wBAC9D,CAAC,CAAC,KAAK,CAAC;oBAEhB,MAAM,iBAAiB,GAAG,YAAY,CAAC,WAAW,CAAC;oBACnD,MAAM,WAAW,GACb,iBAAiB,KAAK,SAAS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