@eqxjs/nest-logger 3.1.0-beta.9 → 3.1.1-beta.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/CHANGELOG +57 -1
- package/MIGRATION.md +234 -0
- package/PERFORMANCE_IMPROVEMENTS.md +158 -0
- package/README.md +2008 -16
- package/RESTRUCTURING_SUMMARY.md +272 -0
- package/STRUCTURE.md +110 -0
- package/dist/constants/action-message.constant.d.ts +187 -0
- package/dist/constants/action-message.constant.js +220 -0
- package/dist/constants/action-message.constant.js.map +1 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.js +9 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/logger.constants.d.ts +17 -0
- package/dist/constants/logger.constants.js +20 -0
- package/dist/constants/logger.constants.js.map +1 -0
- package/dist/core/formatters/index.d.ts +1 -0
- package/dist/core/formatters/index.js +6 -0
- package/dist/core/formatters/index.js.map +1 -0
- package/dist/core/formatters/logger.formatter.d.ts +141 -0
- package/dist/core/formatters/logger.formatter.js +268 -0
- package/dist/core/formatters/logger.formatter.js.map +1 -0
- package/dist/core/loggers/app.logger.d.ts +46 -0
- package/dist/core/loggers/app.logger.js +92 -0
- package/dist/core/loggers/app.logger.js.map +1 -0
- package/dist/core/loggers/base-app.logger.d.ts +299 -0
- package/dist/core/loggers/base-app.logger.js +517 -0
- package/dist/core/loggers/base-app.logger.js.map +1 -0
- package/dist/core/loggers/custom.logger.d.ts +127 -0
- package/dist/core/loggers/custom.logger.js +260 -0
- package/dist/core/loggers/custom.logger.js.map +1 -0
- package/dist/core/loggers/index.d.ts +3 -0
- package/dist/core/loggers/index.js +10 -0
- package/dist/core/loggers/index.js.map +1 -0
- package/dist/helpers/datetime.helper.d.ts +24 -0
- package/dist/helpers/datetime.helper.js +36 -0
- package/dist/helpers/datetime.helper.js.map +1 -0
- package/dist/helpers/index.d.ts +5 -0
- package/dist/helpers/index.js +17 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/helpers/log.helper.d.ts +84 -0
- package/dist/helpers/log.helper.js +109 -0
- package/dist/helpers/log.helper.js.map +1 -0
- package/dist/helpers/logger-builder.helper.d.ts +242 -0
- package/dist/helpers/logger-builder.helper.js +345 -0
- package/dist/helpers/logger-builder.helper.js.map +1 -0
- package/dist/helpers/message-formatter.helper.d.ts +88 -0
- package/dist/helpers/message-formatter.helper.js +159 -0
- package/dist/helpers/message-formatter.helper.js.map +1 -0
- package/dist/helpers/time-performance.helper.d.ts +68 -0
- package/dist/helpers/time-performance.helper.js +82 -0
- package/dist/helpers/time-performance.helper.js.map +1 -0
- package/dist/index.d.ts +13 -5
- package/dist/index.js +24 -9
- package/dist/index.js.map +1 -1
- package/dist/interfaces/data-header.interface.d.ts +21 -0
- package/dist/{dto/m2.dto.js → interfaces/data-header.interface.js} +1 -1
- package/dist/interfaces/data-header.interface.js.map +1 -0
- package/dist/interfaces/data-protocol.interface.d.ts +14 -0
- package/dist/interfaces/data-protocol.interface.js +3 -0
- package/dist/interfaces/data-protocol.interface.js.map +1 -0
- package/dist/interfaces/data-service.interface.d.ts +21 -0
- package/dist/{dto/m3.dto.js → interfaces/data-service.interface.js} +1 -1
- package/dist/interfaces/data-service.interface.js.map +1 -0
- package/dist/{types.d.ts → interfaces/data.interface.d.ts} +4 -4
- package/dist/{dto/m1.dto.js → interfaces/data.interface.js} +1 -1
- package/dist/interfaces/data.interface.js.map +1 -0
- package/dist/interfaces/index.d.ts +5 -0
- package/dist/{types.js → interfaces/index.js} +1 -1
- package/dist/interfaces/index.js.map +1 -0
- package/dist/{dto/header.dto.js → interfaces/logger-opt.interface.js} +1 -1
- package/dist/interfaces/logger-opt.interface.js.map +1 -0
- package/dist/logger.module.js +4 -4
- package/dist/logger.module.js.map +1 -1
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +6 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/logger.dto.d.ts +71 -0
- package/dist/models/logger.dto.js +76 -0
- package/dist/models/logger.dto.js.map +1 -0
- package/package.json +30 -33
- package/dist/dto/header.dto.d.ts +0 -21
- package/dist/dto/header.dto.js.map +0 -1
- package/dist/dto/logger.dto.d.ts +0 -28
- package/dist/dto/logger.dto.js +0 -33
- package/dist/dto/logger.dto.js.map +0 -1
- package/dist/dto/m1.dto.d.ts +0 -7
- package/dist/dto/m1.dto.js.map +0 -1
- package/dist/dto/m2.dto.d.ts +0 -5
- package/dist/dto/m2.dto.js.map +0 -1
- package/dist/dto/m3.dto.d.ts +0 -5
- package/dist/dto/m3.dto.js.map +0 -1
- package/dist/dto/protocol.dto.d.ts +0 -14
- package/dist/dto/protocol.dto.js +0 -3
- package/dist/dto/protocol.dto.js.map +0 -1
- package/dist/dto/service.dto.d.ts +0 -25
- package/dist/dto/service.dto.js +0 -3
- package/dist/dto/service.dto.js.map +0 -1
- package/dist/logger.app.d.ts +0 -62
- package/dist/logger.app.js +0 -504
- package/dist/logger.app.js.map +0 -1
- package/dist/logger.service.d.ts +0 -15
- package/dist/logger.service.js +0 -158
- package/dist/logger.service.js.map +0 -1
- package/dist/logger.util.d.ts +0 -3
- package/dist/logger.util.js +0 -28
- package/dist/logger.util.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/action.common.d.ts +0 -14
- package/dist/utils/action.common.js +0 -43
- package/dist/utils/action.common.js.map +0 -1
- package/dist/utils/datetime.util.d.ts +0 -1
- package/dist/utils/datetime.util.js +0 -13
- package/dist/utils/datetime.util.js.map +0 -1
- package/dist/utils/logger.opt.js +0 -3
- package/dist/utils/logger.opt.js.map +0 -1
- package/dist/utils/m1.utils.d.ts +0 -3
- package/dist/utils/m1.utils.js +0 -79
- package/dist/utils/m1.utils.js.map +0 -1
- package/dist/utils/time.performance.d.ts +0 -6
- package/dist/utils/time.performance.js +0 -18
- package/dist/utils/time.performance.js.map +0 -1
- /package/dist/{utils/logger.opt.d.ts → interfaces/logger-opt.interface.d.ts} +0 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.LoggerFormat = void 0;
|
|
37
|
+
const logger_constants_1 = require("../../constants/logger.constants");
|
|
38
|
+
const message_formatter_helper_1 = require("../../helpers/message-formatter.helper");
|
|
39
|
+
const logUtil = __importStar(require("../../helpers/log.helper"));
|
|
40
|
+
/**
|
|
41
|
+
* LoggerFormat - Format-specific logger for M1, M2, and M3 message protocols.
|
|
42
|
+
*
|
|
43
|
+
* Provides logging capabilities for different message formats used in distributed systems:
|
|
44
|
+
* - **M1**: Message broker/queue operations (Kafka, RabbitMQ, etc.)
|
|
45
|
+
* - **M2**: HTTP/protocol operations (REST APIs, GraphQL, etc.)
|
|
46
|
+
* - **M3**: Service-to-service operations (gRPC, internal services, databases, etc.)
|
|
47
|
+
*
|
|
48
|
+
* Each format requires specific data structures with appropriate header and metadata fields.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* // M1 Format
|
|
53
|
+
* const loggerM1 = new LoggerFormat(baseLogger, 'M1');
|
|
54
|
+
* loggerM1.info('order.topic', '[CONSUMING]', dataM1, 'Processing order');
|
|
55
|
+
*
|
|
56
|
+
* // M2 Format
|
|
57
|
+
* const loggerM2 = new LoggerFormat(baseLogger, 'M2');
|
|
58
|
+
* loggerM2.info('api.users', '[HTTP_REQUEST]', dataM2, 'User creation');
|
|
59
|
+
*
|
|
60
|
+
* // M3 Format
|
|
61
|
+
* const loggerM3 = new LoggerFormat(baseLogger, 'M3');
|
|
62
|
+
* loggerM3.debug('db.users', '[DB_REQUEST]', dataM3, 'Query users');
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
class LoggerFormat {
|
|
66
|
+
messageType;
|
|
67
|
+
logger;
|
|
68
|
+
/**
|
|
69
|
+
* Creates a new LoggerFormat instance.
|
|
70
|
+
*
|
|
71
|
+
* @param logger - BaseAppLogger instance for actual logging
|
|
72
|
+
* @param messageType - Message format type ('M1', 'M2', or 'M3')
|
|
73
|
+
*/
|
|
74
|
+
constructor(logger, messageType) {
|
|
75
|
+
this.messageType = messageType;
|
|
76
|
+
this.logger = logger;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Internal method to handle log level checking and routing.
|
|
80
|
+
*
|
|
81
|
+
* @param level - Log level
|
|
82
|
+
* @param topic - Topic identifier
|
|
83
|
+
* @param action - Action tag
|
|
84
|
+
* @param data - Message data
|
|
85
|
+
* @param message - Optional message text
|
|
86
|
+
* @param opt - Optional configuration
|
|
87
|
+
* @private
|
|
88
|
+
*/
|
|
89
|
+
logMethod(level, topic, action, data, message, opt) {
|
|
90
|
+
if (!logUtil.isLevelEnable(level))
|
|
91
|
+
return;
|
|
92
|
+
this.writeLogCommon(level, topic, action, data, message, opt);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Logs a debug-level message for detailed diagnostic information.
|
|
96
|
+
*
|
|
97
|
+
* @param topic - Topic or identifier (e.g., 'payment.topic', 'api.users')
|
|
98
|
+
* @param action - Action tag (e.g., '[CONSUMING]', '[HTTP_REQUEST]')
|
|
99
|
+
* @param data - Message data (DataM1I, DataM2I, or DataM3I)
|
|
100
|
+
* @param message - Optional descriptive message
|
|
101
|
+
* @param opt - Optional logging configuration
|
|
102
|
+
*/
|
|
103
|
+
debug(topic, action, data, message, opt) {
|
|
104
|
+
this.logMethod(logger_constants_1.LOG_LEVELS.DEBUG, topic, action, data, message, opt);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Logs an info-level message for general information.
|
|
108
|
+
*
|
|
109
|
+
* @param topic - Topic or identifier
|
|
110
|
+
* @param action - Action tag
|
|
111
|
+
* @param data - Message data (DataM1I, DataM2I, or DataM3I)
|
|
112
|
+
* @param message - Optional descriptive message
|
|
113
|
+
* @param opt - Optional logging configuration
|
|
114
|
+
*/
|
|
115
|
+
info(topic, action, data, message, opt) {
|
|
116
|
+
this.logMethod(logger_constants_1.LOG_LEVELS.INFO, topic, action, data, message, opt);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Logs an info-level message (alias for info method).
|
|
120
|
+
*
|
|
121
|
+
* @param topic - Topic or identifier
|
|
122
|
+
* @param action - Action tag
|
|
123
|
+
* @param data - Message data (DataM1I, DataM2I, or DataM3I)
|
|
124
|
+
* @param message - Optional descriptive message
|
|
125
|
+
* @param opt - Optional logging configuration
|
|
126
|
+
*/
|
|
127
|
+
log(topic, action, data, message, opt) {
|
|
128
|
+
this.logMethod(logger_constants_1.LOG_LEVELS.INFO, topic, action, data, message, opt);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Logs an error-level message for error conditions.
|
|
132
|
+
*
|
|
133
|
+
* @param topic - Topic or identifier
|
|
134
|
+
* @param action - Action tag (typically '[EXCEPTION]')
|
|
135
|
+
* @param data - Message data (DataM1I, DataM2I, or DataM3I)
|
|
136
|
+
* @param message - Optional error message
|
|
137
|
+
* @param opt - Optional logging configuration
|
|
138
|
+
*/
|
|
139
|
+
error(topic, action, data, message, opt) {
|
|
140
|
+
this.logMethod(logger_constants_1.LOG_LEVELS.ERROR, topic, action, data, message, opt);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Logs a warning-level message for potentially harmful situations.
|
|
144
|
+
*
|
|
145
|
+
* @param topic - Topic or identifier
|
|
146
|
+
* @param action - Action tag
|
|
147
|
+
* @param data - Message data (DataM1I, DataM2I, or DataM3I)
|
|
148
|
+
* @param message - Optional warning message
|
|
149
|
+
* @param opt - Optional logging configuration
|
|
150
|
+
*/
|
|
151
|
+
warn(topic, action, data, message, opt) {
|
|
152
|
+
this.logMethod(logger_constants_1.LOG_LEVELS.WARN, topic, action, data, message, opt);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Logs a verbose-level message for most detailed information.
|
|
156
|
+
*
|
|
157
|
+
* @param topic - Topic or identifier
|
|
158
|
+
* @param action - Action tag
|
|
159
|
+
* @param data - Message data (DataM1I, DataM2I, or DataM3I)
|
|
160
|
+
* @param message - Optional verbose message
|
|
161
|
+
* @param opt - Optional logging configuration
|
|
162
|
+
*/
|
|
163
|
+
verbose(topic, action, data, message, opt) {
|
|
164
|
+
this.logMethod(logger_constants_1.LOG_LEVELS.VERBOSE, topic, action, data, message, opt);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Routes the message to the appropriate format-specific logger (M1/M2/M3).
|
|
168
|
+
*
|
|
169
|
+
* @param serverity - Log severity level
|
|
170
|
+
* @param action - Action tag
|
|
171
|
+
* @param message - Log message
|
|
172
|
+
* @param data - Message data
|
|
173
|
+
* @param topic - Topic identifier
|
|
174
|
+
* @param opt - Optional configuration
|
|
175
|
+
* @public
|
|
176
|
+
*/
|
|
177
|
+
messageLog(serverity, action, message, data, topic, opt) {
|
|
178
|
+
switch (this.messageType) {
|
|
179
|
+
case 'M1':
|
|
180
|
+
this.m1Logger(serverity, action, message, data, topic, opt);
|
|
181
|
+
break;
|
|
182
|
+
case 'M2':
|
|
183
|
+
this.m2Logger(serverity, action, message, data, topic, opt);
|
|
184
|
+
break;
|
|
185
|
+
case 'M3':
|
|
186
|
+
this.m3Logger(serverity, action, message, data, topic, opt);
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
summarySuccess(topic, appResult, appResultCode, serviceTime, data, opt) {
|
|
191
|
+
switch (this.messageType) {
|
|
192
|
+
case 'M1':
|
|
193
|
+
return this.summaryM1Success(topic, appResult, appResultCode, serviceTime, data, opt);
|
|
194
|
+
case 'M2':
|
|
195
|
+
return this.summaryM2Success(topic, appResult, appResultCode, serviceTime, data, opt);
|
|
196
|
+
case 'M3':
|
|
197
|
+
return this.summaryM3Success(topic, appResult, appResultCode, serviceTime, data, opt);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
summaryError(topic, appResult, appResultCode, serviceTime, data, stack, opt) {
|
|
201
|
+
switch (this.messageType) {
|
|
202
|
+
case 'M1':
|
|
203
|
+
return this.summaryM1Error(topic, appResult, appResultCode, serviceTime, data, stack, opt);
|
|
204
|
+
case 'M2':
|
|
205
|
+
return this.summaryM2Error(topic, appResult, appResultCode, serviceTime, data, stack, opt);
|
|
206
|
+
case 'M3':
|
|
207
|
+
return this.summaryM3Error(topic, appResult, appResultCode, serviceTime, data, stack, opt);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
summaryM1Success(topic, appResult, appResultCode, serviceTime, data, opt) {
|
|
211
|
+
const mergedOpt = (0, message_formatter_helper_1.mergeBrokerOption)(opt, data.header?.broker);
|
|
212
|
+
return this.callSummarySuccess(topic, appResult, appResultCode, serviceTime, data.header, mergedOpt);
|
|
213
|
+
}
|
|
214
|
+
summaryM1Error(topic, appResult, appResultCode, serviceTime, data, stack, opt) {
|
|
215
|
+
const mergedOpt = (0, message_formatter_helper_1.mergeBrokerOption)(opt, data.header?.broker);
|
|
216
|
+
return this.callSummaryError(topic, appResult, appResultCode, serviceTime, data.header, stack, mergedOpt);
|
|
217
|
+
}
|
|
218
|
+
summaryM2Success(topic, appResult, appResultCode, serviceTime, data, opt) {
|
|
219
|
+
const mergedOpt = (0, message_formatter_helper_1.mergeBrokerOption)(opt, data.header?.broker);
|
|
220
|
+
return this.callSummarySuccess(topic, appResult, appResultCode, serviceTime, data.header, mergedOpt);
|
|
221
|
+
}
|
|
222
|
+
summaryM2Error(topic, appResult, appResultCode, serviceTime, data, stack, opt) {
|
|
223
|
+
const mergedOpt = (0, message_formatter_helper_1.mergeBrokerOption)(opt, data.header?.broker);
|
|
224
|
+
return this.callSummaryError(topic, appResult, appResultCode, serviceTime, data.header, stack, mergedOpt);
|
|
225
|
+
}
|
|
226
|
+
summaryM3Success(topic, appResult, appResultCode, serviceTime, data, opt) {
|
|
227
|
+
const mergedOpt = (0, message_formatter_helper_1.mergeBrokerOption)(opt, data.service?.broker);
|
|
228
|
+
return this.callSummarySuccess(topic, appResult, appResultCode, serviceTime, data.service, mergedOpt);
|
|
229
|
+
}
|
|
230
|
+
summaryM3Error(topic, appResult, appResultCode, serviceTime, data, stack, opt) {
|
|
231
|
+
const mergedOpt = (0, message_formatter_helper_1.mergeBrokerOption)(opt, data.service?.broker);
|
|
232
|
+
return this.callSummaryError(topic, appResult, appResultCode, serviceTime, data.service, stack, mergedOpt);
|
|
233
|
+
}
|
|
234
|
+
callSummarySuccess(topic, appResult, appResultCode, serviceTime, source, opt) {
|
|
235
|
+
return this.logger.summarySuccess(appResult, appResultCode, serviceTime, source?.orgService || undefined, topic, source?.session || undefined, source?.transaction || undefined, source?.channel || undefined, process.env.APP_VERSION || '', source?.useCase || undefined, source?.useCaseStep || undefined, source?.identity?.user || undefined, source?.identity?.device || undefined, source?.identity?.public || undefined, opt);
|
|
236
|
+
}
|
|
237
|
+
callSummaryError(topic, appResult, appResultCode, serviceTime, source, stack, opt) {
|
|
238
|
+
return this.logger.summaryError(appResult, appResultCode, serviceTime, source?.orgService || undefined, topic, source?.session || undefined, source?.transaction || undefined, source?.channel || undefined, process.env.APP_VERSION || '', source?.useCase || undefined, source?.useCaseStep || undefined, source?.identity?.user || undefined, source?.identity?.device || undefined, source?.identity?.public || undefined, stack, opt);
|
|
239
|
+
}
|
|
240
|
+
writeLogCommon(functionName, topic, action, data, message, opt) {
|
|
241
|
+
try {
|
|
242
|
+
this.messageLog(functionName, action, message ?? data, data, topic, opt);
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
this.logger.error(`Cannot write log from data error:[${error}] [${data}]`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
m1Logger(severity, action, message, data, topic, opt) {
|
|
249
|
+
const mergedOpt = (0, message_formatter_helper_1.mergeBrokerOption)(opt, data.header?.broker);
|
|
250
|
+
this.callLogger(severity, action, message, data.header, topic, mergedOpt);
|
|
251
|
+
}
|
|
252
|
+
m2Logger(severity, action, message, data, topic, opt) {
|
|
253
|
+
const mergedOpt = (0, message_formatter_helper_1.mergeBrokerOption)(opt, data.header?.broker);
|
|
254
|
+
this.callLogger(severity, action, message, data.header, topic, mergedOpt);
|
|
255
|
+
}
|
|
256
|
+
m3Logger(severity, action, message, data, topic, opt) {
|
|
257
|
+
const mergedOpt = (0, message_formatter_helper_1.mergeBrokerOption)(opt, data.service?.broker);
|
|
258
|
+
this.callLogger(severity, action, message, data.service, topic, mergedOpt);
|
|
259
|
+
}
|
|
260
|
+
callLogger(severity, action, message, source, topic, opt) {
|
|
261
|
+
const logFn = this.logger[severity];
|
|
262
|
+
if (typeof logFn === 'function') {
|
|
263
|
+
logFn.call(this.logger, message, action, source?.orgService || undefined, topic, source?.session || undefined, source?.transaction || undefined, source?.channel || undefined, process.env.APP_VERSION || '', source?.useCase || undefined, source?.useCaseStep || undefined, source?.identity?.user || undefined, source?.identity?.device || undefined, source?.identity?.public || undefined, opt);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
exports.LoggerFormat = LoggerFormat;
|
|
268
|
+
//# sourceMappingURL=logger.formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.formatter.js","sourceRoot":"","sources":["../../../src/core/formatters/logger.formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,uEAA8D;AAC9D,qFAA2E;AAC3E,kEAAoD;AAIpD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAa,YAAY;IAWF;IAVb,MAAM,CAAgB;IAE9B;;;;;OAKG;IACH,YACE,MAAqB,EACF,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;QAE3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;;;;OAUG;IACK,SAAS,CACf,KAAa,EACb,KAAa,EACb,MAAc,EACd,IAAS,EACT,OAAgB,EAChB,GAAe;QAEf,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC;YAAE,OAAO;QAC1C,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IAChE,CAAC;IAED;;;;;;;;OAQG;IACI,KAAK,CACV,KAAa,EACb,MAA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,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC/D,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IAC7E,CAAC;IAEO,UAAU,CAChB,QAAgB,EAChB,MAAc,EACd,OAAY,EACZ,MAAW,EACX,KAAa,EACb,GAAe;QAEf,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,QAA+B,CAAQ,CAAC;QAClE,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;YAChC,KAAK,CAAC,IAAI,CACR,IAAI,CAAC,MAAM,EACX,OAAO,EACP,MAAM,EACN,MAAM,EAAE,UAAU,IAAI,SAAS,EAC/B,KAAK,EACL,MAAM,EAAE,OAAO,IAAI,SAAS,EAC5B,MAAM,EAAE,WAAW,IAAI,SAAS,EAChC,MAAM,EAAE,OAAO,IAAI,SAAS,EAC5B,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,EAC7B,MAAM,EAAE,OAAO,IAAI,SAAS,EAC5B,MAAM,EAAE,WAAW,IAAI,SAAS,EAChC,MAAM,EAAE,QAAQ,EAAE,IAAI,IAAI,SAAS,EACnC,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,SAAS,EACrC,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,SAAS,EACrC,GAAG,CACJ,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AA7gBD,oCA6gBC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { BaseAppLogger } from './base-app.logger';
|
|
2
|
+
import { LoggerFormat } from '../formatters/logger.formatter';
|
|
3
|
+
/**
|
|
4
|
+
* AppLogger - Unified logger providing access to all logger types.
|
|
5
|
+
*
|
|
6
|
+
* Provides a single entry point for accessing different logger implementations:
|
|
7
|
+
* - `app`: BaseAppLogger for standard structured logging
|
|
8
|
+
* - `loggerM1`: LoggerFormat for M1 message format (broker/queue operations)
|
|
9
|
+
* - `loggerM2`: LoggerFormat for M2 message format (HTTP/protocol operations)
|
|
10
|
+
* - `loggerM3`: LoggerFormat for M3 message format (service-to-service operations)
|
|
11
|
+
*
|
|
12
|
+
* This wrapper class simplifies logger initialization and provides consistent
|
|
13
|
+
* access patterns across different message formats.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const logger = new AppLogger('MyApp', 'MyService');
|
|
18
|
+
*
|
|
19
|
+
* // Use standard structured logger
|
|
20
|
+
* logger.app.info('Operation completed', '[INFO]');
|
|
21
|
+
*
|
|
22
|
+
* // Use M1 format for Kafka messages
|
|
23
|
+
* logger.loggerM1.info('order.topic', '[CONSUMING]', dataM1, 'Processing order');
|
|
24
|
+
*
|
|
25
|
+
* // Use M2 format for HTTP requests
|
|
26
|
+
* logger.loggerM2.info('api.endpoint', '[HTTP_REQUEST]', dataM2, 'Request received');
|
|
27
|
+
*
|
|
28
|
+
* // Use M3 format for database operations
|
|
29
|
+
* logger.loggerM3.debug('db.users', '[DB_REQUEST]', dataM3, 'Querying users');
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare class AppLogger {
|
|
33
|
+
protected appName: string;
|
|
34
|
+
protected context?: string;
|
|
35
|
+
/** Standard structured logger with OpenTelemetry integration */
|
|
36
|
+
app: BaseAppLogger;
|
|
37
|
+
/** M1 format logger for broker/queue message operations */
|
|
38
|
+
loggerM1: LoggerFormat;
|
|
39
|
+
/** M2 format logger for HTTP/protocol operations */
|
|
40
|
+
loggerM2: LoggerFormat;
|
|
41
|
+
/** M3 format logger for service-to-service operations */
|
|
42
|
+
loggerM3: LoggerFormat;
|
|
43
|
+
constructor();
|
|
44
|
+
constructor(appName?: string);
|
|
45
|
+
constructor(appName?: string, context?: string);
|
|
46
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AppLogger = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const base_app_logger_1 = require("./base-app.logger");
|
|
18
|
+
const logger_formatter_1 = require("../formatters/logger.formatter");
|
|
19
|
+
/**
|
|
20
|
+
* AppLogger - Unified logger providing access to all logger types.
|
|
21
|
+
*
|
|
22
|
+
* Provides a single entry point for accessing different logger implementations:
|
|
23
|
+
* - `app`: BaseAppLogger for standard structured logging
|
|
24
|
+
* - `loggerM1`: LoggerFormat for M1 message format (broker/queue operations)
|
|
25
|
+
* - `loggerM2`: LoggerFormat for M2 message format (HTTP/protocol operations)
|
|
26
|
+
* - `loggerM3`: LoggerFormat for M3 message format (service-to-service operations)
|
|
27
|
+
*
|
|
28
|
+
* This wrapper class simplifies logger initialization and provides consistent
|
|
29
|
+
* access patterns across different message formats.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const logger = new AppLogger('MyApp', 'MyService');
|
|
34
|
+
*
|
|
35
|
+
* // Use standard structured logger
|
|
36
|
+
* logger.app.info('Operation completed', '[INFO]');
|
|
37
|
+
*
|
|
38
|
+
* // Use M1 format for Kafka messages
|
|
39
|
+
* logger.loggerM1.info('order.topic', '[CONSUMING]', dataM1, 'Processing order');
|
|
40
|
+
*
|
|
41
|
+
* // Use M2 format for HTTP requests
|
|
42
|
+
* logger.loggerM2.info('api.endpoint', '[HTTP_REQUEST]', dataM2, 'Request received');
|
|
43
|
+
*
|
|
44
|
+
* // Use M3 format for database operations
|
|
45
|
+
* logger.loggerM3.debug('db.users', '[DB_REQUEST]', dataM3, 'Querying users');
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
let AppLogger = class AppLogger {
|
|
49
|
+
appName;
|
|
50
|
+
context;
|
|
51
|
+
/** Standard structured logger with OpenTelemetry integration */
|
|
52
|
+
app;
|
|
53
|
+
/** M1 format logger for broker/queue message operations */
|
|
54
|
+
loggerM1;
|
|
55
|
+
/** M2 format logger for HTTP/protocol operations */
|
|
56
|
+
loggerM2;
|
|
57
|
+
/** M3 format logger for service-to-service operations */
|
|
58
|
+
loggerM3;
|
|
59
|
+
/**
|
|
60
|
+
* Creates a new AppLogger instance with all logger types initialized.
|
|
61
|
+
*
|
|
62
|
+
* @param appName - Name of the application (default: 'EQXJS')
|
|
63
|
+
* @param context - Optional context or component name
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* // Default initialization
|
|
68
|
+
* const logger1 = new AppLogger();
|
|
69
|
+
*
|
|
70
|
+
* // With app name
|
|
71
|
+
* const logger2 = new AppLogger('MyApp');
|
|
72
|
+
*
|
|
73
|
+
* // With app name and context
|
|
74
|
+
* const logger3 = new AppLogger('MyApp', 'UserService');
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
constructor(appName = 'EQXJS', context) {
|
|
78
|
+
this.appName = appName;
|
|
79
|
+
this.context = context;
|
|
80
|
+
this.app = new base_app_logger_1.BaseAppLogger(this.appName, this.context);
|
|
81
|
+
this.loggerM1 = new logger_formatter_1.LoggerFormat(this.app, 'M1');
|
|
82
|
+
this.loggerM2 = new logger_formatter_1.LoggerFormat(this.app, 'M2');
|
|
83
|
+
this.loggerM3 = new logger_formatter_1.LoggerFormat(this.app, 'M3');
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
exports.AppLogger = AppLogger;
|
|
87
|
+
exports.AppLogger = AppLogger = __decorate([
|
|
88
|
+
__param(0, (0, common_1.Optional)()),
|
|
89
|
+
__param(1, (0, common_1.Optional)()),
|
|
90
|
+
__metadata("design:paramtypes", [String, String])
|
|
91
|
+
], AppLogger);
|
|
92
|
+
//# sourceMappingURL=app.logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.logger.js","sourceRoot":"","sources":["../../../src/core/loggers/app.logger.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA0C;AAC1C,uDAAkD;AAClD,qEAA8D;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,IAAa,SAAS,GAAtB,MAAa,SAAS;IAmCI;IACA;IAnCxB,gEAAgE;IACzD,GAAG,CAAgB;IAE1B,2DAA2D;IACpD,QAAQ,CAAe;IAE9B,oDAAoD;IAC7C,QAAQ,CAAe;IAE9B,yDAAyD;IAClD,QAAQ,CAAe;IAK9B;;;;;;;;;;;;;;;;;OAiBG;IACH,YACwB,UAAkB,OAAO,EACzB,OAAgB;QADhB,YAAO,GAAP,OAAO,CAAkB;QACzB,YAAO,GAAP,OAAO,CAAS;QAEtC,IAAI,CAAC,GAAG,GAAG,IAAI,+BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACzD,IAAI,CAAC,QAAQ,GAAG,IAAI,+BAAY,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACjD,IAAI,CAAC,QAAQ,GAAG,IAAI,+BAAY,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACjD,IAAI,CAAC,QAAQ,GAAG,IAAI,+BAAY,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;CACF,CAAA;AA3CY,8BAAS;oBAAT,SAAS;IAmCjB,WAAA,IAAA,iBAAQ,GAAE,CAAA;IACV,WAAA,IAAA,iBAAQ,GAAE,CAAA;;GApCF,SAAS,CA2CrB"}
|