@infineit/winston-logger 1.0.32 → 1.0.34
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 +53 -102
- package/context/infrastructure/nestjs/contextModule.js +3 -3
- 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,24 @@ 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:** `ContextModule` internally imports and exports `ClsModule.forRoot()` with `mount: true` and `generateId: true`. **Applications MUST NOT import `ClsModule` separately** - just import `ContextModule`.
|
|
57
|
+
|
|
58
|
+
**Correct import:**
|
|
59
|
+
```typescript
|
|
60
|
+
@Module({
|
|
61
|
+
imports: [
|
|
62
|
+
ConfigModule.forRoot({ isGlobal: true }),
|
|
63
|
+
ContextModule, // ✅ Includes ClsModule internally
|
|
64
|
+
LoggerModule.forRoot(), // ✅ Then configure logger
|
|
65
|
+
],
|
|
66
|
+
})
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**❌ Incorrect:** Do NOT import `ClsModule.forRoot()` in your `AppModule`. `ContextModule` handles it internally.
|
|
52
70
|
|
|
53
71
|
---
|
|
54
72
|
|
|
@@ -64,7 +82,7 @@ import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
|
64
82
|
@Module({
|
|
65
83
|
imports: [
|
|
66
84
|
ConfigModule.forRoot({ isGlobal: true }),
|
|
67
|
-
ContextModule, //
|
|
85
|
+
ContextModule, // Includes ClsModule internally with mount: true and generateId: true
|
|
68
86
|
LoggerModule.forRoot(), // Configure logger
|
|
69
87
|
],
|
|
70
88
|
})
|
|
@@ -183,6 +201,7 @@ const config: LoggerModuleConfig = {
|
|
|
183
201
|
|
|
184
202
|
@Module({
|
|
185
203
|
imports: [
|
|
204
|
+
ContextModule, // Includes ClsModule internally
|
|
186
205
|
LoggerModule.forRoot(config),
|
|
187
206
|
],
|
|
188
207
|
})
|
|
@@ -239,6 +258,7 @@ export default registerAs('logger', () => ({
|
|
|
239
258
|
isGlobal: true,
|
|
240
259
|
load: [loggerConfig],
|
|
241
260
|
}),
|
|
261
|
+
ContextModule, // Includes ClsModule internally
|
|
242
262
|
LoggerModule.forRoot(), // Will read from ConfigService
|
|
243
263
|
],
|
|
244
264
|
})
|
|
@@ -334,21 +354,14 @@ export class UserController {
|
|
|
334
354
|
}
|
|
335
355
|
```
|
|
336
356
|
|
|
337
|
-
**Important**: For HTTP services,
|
|
357
|
+
**Important**: For HTTP services, `ContextModule` automatically configures CLS middleware with `mount: true` and `generateId: true`. Correlation IDs are handled automatically.
|
|
338
358
|
|
|
339
359
|
```typescript
|
|
340
|
-
import {
|
|
360
|
+
import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
341
361
|
|
|
342
362
|
@Module({
|
|
343
363
|
imports: [
|
|
344
|
-
ClsModule
|
|
345
|
-
middleware: {
|
|
346
|
-
mount: true, // Enable middleware
|
|
347
|
-
generateId: true, // Auto-generate correlation ID
|
|
348
|
-
idGenerator: (req: Request) => req.headers['x-correlation-id'] || uuidv4(),
|
|
349
|
-
},
|
|
350
|
-
}),
|
|
351
|
-
ContextModule, // Provides CLS service
|
|
364
|
+
ContextModule, // Includes ClsModule internally with mount: true and generateId: true
|
|
352
365
|
LoggerModule.forRoot(),
|
|
353
366
|
],
|
|
354
367
|
})
|
|
@@ -541,8 +554,8 @@ export class KafkaTransport implements LoggerTransport {
|
|
|
541
554
|
### Registering Custom Transports
|
|
542
555
|
|
|
543
556
|
```typescript
|
|
544
|
-
import { Provider } from '@nestjs/common';
|
|
545
|
-
import { LoggerModule } from '@infineit/winston-logger';
|
|
557
|
+
import { Provider, Module } from '@nestjs/common';
|
|
558
|
+
import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
546
559
|
import { KafkaTransport } from './kafka-transport';
|
|
547
560
|
|
|
548
561
|
const customTransports: Provider[] = [
|
|
@@ -554,6 +567,7 @@ const customTransports: Provider[] = [
|
|
|
554
567
|
|
|
555
568
|
@Module({
|
|
556
569
|
imports: [
|
|
570
|
+
ContextModule, // Includes ClsModule internally
|
|
557
571
|
LoggerModule.forRoot(config, customTransports),
|
|
558
572
|
],
|
|
559
573
|
})
|
|
@@ -598,8 +612,11 @@ LOGGER_HTTP_ENDPOINT=https://logging-service.example.com/api/logs
|
|
|
598
612
|
|
|
599
613
|
**Via Module Configuration:**
|
|
600
614
|
```typescript
|
|
615
|
+
import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
616
|
+
|
|
601
617
|
@Module({
|
|
602
618
|
imports: [
|
|
619
|
+
ContextModule, // Includes ClsModule internally
|
|
603
620
|
LoggerModule.forRoot({
|
|
604
621
|
// ... existing config
|
|
605
622
|
forwardToCentral: true,
|
|
@@ -747,7 +764,7 @@ LOGGER_KAFKA_TOPIC=project-logs-common
|
|
|
747
764
|
5. Check console errors: Forwarding errors are logged to `console.error` with message `"CentralLogForwarder forward error (swallowed): <error>"`
|
|
748
765
|
|
|
749
766
|
**Correlation ID Missing:**
|
|
750
|
-
- Ensure
|
|
767
|
+
- Ensure `ContextModule` is imported: `ContextModule` automatically configures `ClsModule` with `generateId: true`
|
|
751
768
|
- Ensure `ContextModule` is imported
|
|
752
769
|
- Check that original logs have `correlationId` field (if not, forwarded logs won't either)
|
|
753
770
|
|
|
@@ -876,31 +893,22 @@ Correlation ID is **optional** - `undefined` is valid:
|
|
|
876
893
|
|
|
877
894
|
### HTTP Context Setup
|
|
878
895
|
|
|
879
|
-
For HTTP services,
|
|
896
|
+
For HTTP services, `ContextModule` automatically configures CLS middleware. No additional setup required:
|
|
880
897
|
|
|
881
898
|
```typescript
|
|
882
|
-
import {
|
|
883
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
899
|
+
import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
884
900
|
|
|
885
901
|
@Module({
|
|
886
902
|
imports: [
|
|
887
|
-
ClsModule
|
|
888
|
-
middleware: {
|
|
889
|
-
mount: true,
|
|
890
|
-
generateId: true,
|
|
891
|
-
idGenerator: (req: Request) => {
|
|
892
|
-
// Use existing correlation ID from header, or generate new one
|
|
893
|
-
return req.headers['x-correlation-id'] as string || uuidv4();
|
|
894
|
-
},
|
|
895
|
-
},
|
|
896
|
-
}),
|
|
897
|
-
ContextModule, // Provides CLS service
|
|
903
|
+
ContextModule, // Automatically configures ClsModule with mount: true and generateId: true
|
|
898
904
|
LoggerModule.forRoot(),
|
|
899
905
|
],
|
|
900
906
|
})
|
|
901
907
|
export class AppModule {}
|
|
902
908
|
```
|
|
903
909
|
|
|
910
|
+
**Important:** `ContextModule` internally handles `ClsModule` configuration. Do NOT import `ClsModule` separately in your `AppModule`.
|
|
911
|
+
|
|
904
912
|
### CLS Context Boundaries and Edge Cases
|
|
905
913
|
|
|
906
914
|
#### Async Context Propagation
|
|
@@ -1069,27 +1077,7 @@ if (correlationId && validateCorrelationId(correlationId)) {
|
|
|
1069
1077
|
|
|
1070
1078
|
#### Validation in HTTP Middleware
|
|
1071
1079
|
|
|
1072
|
-
|
|
1073
|
-
import { v4 as uuidv4, validate as uuidValidate } from 'uuid';
|
|
1074
|
-
|
|
1075
|
-
ClsModule.forRoot({
|
|
1076
|
-
middleware: {
|
|
1077
|
-
mount: true,
|
|
1078
|
-
generateId: true,
|
|
1079
|
-
idGenerator: (req: Request) => {
|
|
1080
|
-
const headerId = req.headers['x-correlation-id'] as string;
|
|
1081
|
-
|
|
1082
|
-
// Validate format
|
|
1083
|
-
if (headerId && uuidValidate(headerId)) {
|
|
1084
|
-
return headerId;
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
|
-
// Generate new one if invalid
|
|
1088
|
-
return uuidv4();
|
|
1089
|
-
},
|
|
1090
|
-
},
|
|
1091
|
-
})
|
|
1092
|
-
```
|
|
1080
|
+
**Note:** `ContextModule` automatically configures `ClsModule` with `mount: true` and `generateId: true`. Correlation IDs are automatically generated. If you need custom validation, you can access `ClsService` directly (exported by `ContextModule`) or use `ContextStorageService.setContextId()` in your middleware.
|
|
1093
1081
|
|
|
1094
1082
|
#### Validation in Kafka Consumers
|
|
1095
1083
|
|
|
@@ -1120,24 +1108,12 @@ async handleOrderCreated(message: OrderCreatedEvent) {
|
|
|
1120
1108
|
```typescript
|
|
1121
1109
|
import { Module, MiddlewareConsumer, NestModule } from '@nestjs/common';
|
|
1122
1110
|
import { ConfigModule } from '@nestjs/config';
|
|
1123
|
-
import { ClsModule } from 'nestjs-cls';
|
|
1124
|
-
import { v4 as uuidv4, validate as uuidValidate } from 'uuid';
|
|
1125
1111
|
import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
1126
1112
|
|
|
1127
1113
|
@Module({
|
|
1128
1114
|
imports: [
|
|
1129
1115
|
ConfigModule.forRoot({ isGlobal: true }),
|
|
1130
|
-
ClsModule
|
|
1131
|
-
middleware: {
|
|
1132
|
-
mount: true,
|
|
1133
|
-
generateId: true,
|
|
1134
|
-
idGenerator: (req: Request) => {
|
|
1135
|
-
const headerId = req.headers['x-correlation-id'] as string;
|
|
1136
|
-
return (headerId && uuidValidate(headerId)) ? headerId : uuidv4();
|
|
1137
|
-
},
|
|
1138
|
-
},
|
|
1139
|
-
}),
|
|
1140
|
-
ContextModule,
|
|
1116
|
+
ContextModule, // Includes ClsModule internally with mount: true and generateId: true
|
|
1141
1117
|
LoggerModule.forRoot({
|
|
1142
1118
|
nodeEnv: process.env.NODE_ENV,
|
|
1143
1119
|
organization: 'sales',
|
|
@@ -1149,7 +1125,7 @@ import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
|
1149
1125
|
export class AppModule implements NestModule {
|
|
1150
1126
|
configure(consumer: MiddlewareConsumer) {
|
|
1151
1127
|
// Additional middleware can be added here
|
|
1152
|
-
//
|
|
1128
|
+
// ContextModule already configures ClsModule middleware internally
|
|
1153
1129
|
}
|
|
1154
1130
|
}
|
|
1155
1131
|
```
|
|
@@ -1573,19 +1549,11 @@ async createInvoice(@Body() data: CreateInvoiceDto, @Headers() headers: Headers)
|
|
|
1573
1549
|
**4. Common Service (app.module.ts):**
|
|
1574
1550
|
|
|
1575
1551
|
```typescript
|
|
1552
|
+
import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
1553
|
+
|
|
1576
1554
|
@Module({
|
|
1577
1555
|
imports: [
|
|
1578
|
-
ClsModule
|
|
1579
|
-
middleware: {
|
|
1580
|
-
mount: true,
|
|
1581
|
-
generateId: true,
|
|
1582
|
-
idGenerator: (req: Request) => {
|
|
1583
|
-
// Extract from header (propagated from Document Service)
|
|
1584
|
-
return req.headers['x-correlation-id'] as string || uuidv4();
|
|
1585
|
-
},
|
|
1586
|
-
},
|
|
1587
|
-
}),
|
|
1588
|
-
ContextModule,
|
|
1556
|
+
ContextModule, // Includes ClsModule internally with mount: true and generateId: true
|
|
1589
1557
|
LoggerModule.forRoot(),
|
|
1590
1558
|
],
|
|
1591
1559
|
})
|
|
@@ -1754,7 +1722,7 @@ import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
|
1754
1722
|
|
|
1755
1723
|
@Module({
|
|
1756
1724
|
imports: [
|
|
1757
|
-
ContextModule,
|
|
1725
|
+
ContextModule, // ✅ Includes ClsModule internally with mount: true and generateId: true
|
|
1758
1726
|
LoggerModule.forRoot(),
|
|
1759
1727
|
],
|
|
1760
1728
|
})
|
|
@@ -1858,15 +1826,11 @@ export class MyService {
|
|
|
1858
1826
|
this.logger.info('message');
|
|
1859
1827
|
```
|
|
1860
1828
|
|
|
1861
|
-
5. **
|
|
1829
|
+
5. **Import ContextModule (automatically configures CLS middleware)**
|
|
1862
1830
|
```typescript
|
|
1863
|
-
// ✅
|
|
1864
|
-
ClsModule
|
|
1865
|
-
|
|
1866
|
-
mount: true,
|
|
1867
|
-
generateId: true,
|
|
1868
|
-
},
|
|
1869
|
-
}),
|
|
1831
|
+
// ✅ ContextModule automatically configures ClsModule with mount: true and generateId: true
|
|
1832
|
+
// No need to import ClsModule separately
|
|
1833
|
+
ContextModule,
|
|
1870
1834
|
```
|
|
1871
1835
|
|
|
1872
1836
|
### Reassurance: Nothing Breaks
|
|
@@ -1912,16 +1876,12 @@ async function bootstrap() {
|
|
|
1912
1876
|
**After (Current)**:
|
|
1913
1877
|
```typescript
|
|
1914
1878
|
import { NestFactory } from '@nestjs/core';
|
|
1915
|
-
import { ClsModule } from 'nestjs-cls';
|
|
1916
1879
|
import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
1917
1880
|
|
|
1918
1881
|
@Module({
|
|
1919
1882
|
imports: [
|
|
1920
|
-
ClsModule
|
|
1921
|
-
|
|
1922
|
-
}),
|
|
1923
|
-
ContextModule, // ✅ Add
|
|
1924
|
-
LoggerModule.forRoot(), // ✅ Add
|
|
1883
|
+
ContextModule, // ✅ Includes ClsModule internally with mount: true and generateId: true
|
|
1884
|
+
LoggerModule.forRoot(), // ✅ Configure logger
|
|
1925
1885
|
],
|
|
1926
1886
|
})
|
|
1927
1887
|
export class AppModule {}
|
|
@@ -1939,9 +1899,11 @@ async function bootstrap() {
|
|
|
1939
1899
|
If you encounter issues during migration:
|
|
1940
1900
|
|
|
1941
1901
|
1. **Check module imports**: Ensure `ContextModule` and `LoggerModule.forRoot()` are in your `AppModule`
|
|
1942
|
-
2. **
|
|
1902
|
+
2. **Do NOT import ClsModule**: `ContextModule` handles `ClsModule` internally - do NOT import it separately
|
|
1943
1903
|
3. **Check injection**: Ensure `LoggerService` is injected via constructor
|
|
1944
1904
|
4. **Review examples**: See the "Usage in Different Contexts" section above
|
|
1905
|
+
4. **Check injection**: Ensure `LoggerService` is injected via constructor
|
|
1906
|
+
5. **Review examples**: See the "Usage in Different Contexts" section above
|
|
1945
1907
|
|
|
1946
1908
|
---
|
|
1947
1909
|
|
|
@@ -2102,22 +2064,12 @@ async log(...) { // ❌
|
|
|
2102
2064
|
```typescript
|
|
2103
2065
|
import { Module } from '@nestjs/common';
|
|
2104
2066
|
import { ConfigModule } from '@nestjs/config';
|
|
2105
|
-
import { ClsModule } from 'nestjs-cls';
|
|
2106
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
2107
2067
|
import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
2108
2068
|
|
|
2109
2069
|
@Module({
|
|
2110
2070
|
imports: [
|
|
2111
2071
|
ConfigModule.forRoot({ isGlobal: true }),
|
|
2112
|
-
ClsModule
|
|
2113
|
-
middleware: {
|
|
2114
|
-
mount: true,
|
|
2115
|
-
generateId: true,
|
|
2116
|
-
idGenerator: (req: Request) =>
|
|
2117
|
-
req.headers['x-correlation-id'] as string || uuidv4(),
|
|
2118
|
-
},
|
|
2119
|
-
}),
|
|
2120
|
-
ContextModule,
|
|
2072
|
+
ContextModule, // Includes ClsModule internally with mount: true and generateId: true
|
|
2121
2073
|
LoggerModule.forRoot({
|
|
2122
2074
|
nodeEnv: process.env.NODE_ENV,
|
|
2123
2075
|
organization: 'my-org',
|
|
@@ -2127,7 +2079,6 @@ import { ContextModule, LoggerModule } from '@infineit/winston-logger';
|
|
|
2127
2079
|
],
|
|
2128
2080
|
})
|
|
2129
2081
|
export class AppModule {}
|
|
2130
|
-
```
|
|
2131
2082
|
|
|
2132
2083
|
```typescript
|
|
2133
2084
|
import { Injectable } from '@nestjs/common';
|
|
@@ -24,8 +24,8 @@ exports.ContextModule = ContextModule = __decorate([
|
|
|
24
24
|
nestjs_cls_1.ClsModule.forRoot({
|
|
25
25
|
global: true,
|
|
26
26
|
middleware: {
|
|
27
|
-
mount:
|
|
28
|
-
generateId:
|
|
27
|
+
mount: true,
|
|
28
|
+
generateId: true,
|
|
29
29
|
},
|
|
30
30
|
}),
|
|
31
31
|
],
|
|
@@ -36,7 +36,7 @@ exports.ContextModule = ContextModule = __decorate([
|
|
|
36
36
|
useClass: nestjsClsContextStorageService_1.default,
|
|
37
37
|
},
|
|
38
38
|
],
|
|
39
|
-
exports: [contextStorageService_1.ContextStorageServiceKey],
|
|
39
|
+
exports: [contextStorageService_1.ContextStorageServiceKey, nestjs_cls_1.ClsModule],
|
|
40
40
|
})
|
|
41
41
|
], ContextModule);
|
|
42
42
|
//# sourceMappingURL=contextModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextModule.js","sourceRoot":"","sources":["../../../../../libs/src/context/infrastructure/nestjs/contextModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAgD;AAEhD,2CAAuC;AAEvC,oGAAoG;AACpG,+IAAuH;
|
|
1
|
+
{"version":3,"file":"contextModule.js","sourceRoot":"","sources":["../../../../../libs/src/context/infrastructure/nestjs/contextModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAgD;AAEhD,2CAAuC;AAEvC,oGAAoG;AACpG,+IAAuH;AA8ChH,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,sCAAa;wBAAb,aAAa;IAtBzB,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACJ,OAAO,EAAE;YAGL,sBAAS,CAAC,OAAO,CAAC;gBACd,MAAM,EAAE,IAAI;gBACZ,UAAU,EAAE;oBACR,KAAK,EAAE,IAAI;oBACX,UAAU,EAAE,IAAI;iBACnB;aACJ,CAAC;SACL;QACD,WAAW,EAAE,EAAE;QACf,SAAS,EAAE;YACP;gBACI,OAAO,EAAE,gDAAwB;gBACjC,QAAQ,EAAE,wCAA8B;aAC3C;SACJ;QACD,OAAO,EAAE,CAAC,gDAAwB,EAAE,sBAAS,CAAC;KACjD,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;IA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C,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,C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EtB,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,GAAe,IAAI,CAAC;IAEzC,YAAY,KAAa,EAAE,aAAmB;QAC1C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,aAAa,GAAG,aAAa,IAAI,IAAI,CAAC;IAC/C,CAAC;IAMM,gBAAgB,CAAC,QAAa;QACjC,IAAI,CAAC;YACD,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC;QAClC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAEb,OAAO,CAAC,KAAK,CAAC,8DAA8D,EAAE,KAAK,CAAC,CAAC;QACzF,CAAC;IACL,CAAC;IAMM,OAAO,CAAC,aAA4B;QACvC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YAGtB,OAAO;QACX,CAAC;QAED,IAAI,CAAC;YACD,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;YAIjD,IAAI,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;gBAChD,IAAI,CAAC,aAAa;qBACb,IAAI,CAAC;oBACF,KAAK,EAAE,IAAI,CAAC,KAAK;oBACjB,QAAQ,EAAE;wBACN;4BACI,GAAG,EAAE,aAAa,CAAC,aAAa,IAAI,mBAAmB;4BACvD,KAAK,EAAE,UAAU;4BACjB,OAAO,EAAE,aAAa,CAAC,aAAa;gCAChC,CAAC,CAAC,EAAE,kBAAkB,EAAE,aAAa,CAAC,aAAa,EAAE;gCACrD,CAAC,CAAC,EAAE;yBACX;qBACJ;iBACJ,CAAC;qBACD,KAAK,CAAC,CAAC,KAAU,EAAE,EAAE;oBAElB,OAAO,CAAC,KAAK,CAAC,kDAAkD,EAAE,KAAK,CAAC,CAAC;gBAC7E,CAAC,CAAC,CAAC;YACX,CAAC;QAGL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAEb,OAAO,CAAC,KAAK,CAAC,qDAAqD,EAAE,KAAK,CAAC,CAAC;QAChF,CAAC;IACL,CAAC;CACJ;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,YA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