@nicollasfrazao/liguelead-log-service 1.0.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.
Files changed (67) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +689 -0
  3. package/dist/configs/log.service.config.d.ts +8 -0
  4. package/dist/configs/log.service.config.d.ts.map +1 -0
  5. package/dist/configs/log.service.config.js +50 -0
  6. package/dist/configs/log.service.config.js.map +1 -0
  7. package/dist/configs/log.storage.external.s3.config.d.ts +8 -0
  8. package/dist/configs/log.storage.external.s3.config.d.ts.map +1 -0
  9. package/dist/configs/log.storage.external.s3.config.js +27 -0
  10. package/dist/configs/log.storage.external.s3.config.js.map +1 -0
  11. package/dist/errors/log.error.d.ts +25 -0
  12. package/dist/errors/log.error.d.ts.map +1 -0
  13. package/dist/errors/log.error.js +27 -0
  14. package/dist/errors/log.error.js.map +1 -0
  15. package/dist/index.d.ts +22 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +35 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/interfaces/log.service.config.interface.d.ts +84 -0
  20. package/dist/interfaces/log.service.config.interface.d.ts.map +1 -0
  21. package/dist/interfaces/log.service.config.interface.js +3 -0
  22. package/dist/interfaces/log.service.config.interface.js.map +1 -0
  23. package/dist/interfaces/log.storage.base.service.interface.d.ts +21 -0
  24. package/dist/interfaces/log.storage.base.service.interface.d.ts.map +1 -0
  25. package/dist/interfaces/log.storage.base.service.interface.js +3 -0
  26. package/dist/interfaces/log.storage.base.service.interface.js.map +1 -0
  27. package/dist/interfaces/log.storage.external.s3.service.config.interface.d.ts +39 -0
  28. package/dist/interfaces/log.storage.external.s3.service.config.interface.d.ts.map +1 -0
  29. package/dist/interfaces/log.storage.external.s3.service.config.interface.js +3 -0
  30. package/dist/interfaces/log.storage.external.s3.service.config.interface.js.map +1 -0
  31. package/dist/middlewares/log.middleware.d.ts +12 -0
  32. package/dist/middlewares/log.middleware.d.ts.map +1 -0
  33. package/dist/middlewares/log.middleware.js +63 -0
  34. package/dist/middlewares/log.middleware.js.map +1 -0
  35. package/dist/services/log.service.d.ts +224 -0
  36. package/dist/services/log.service.d.ts.map +1 -0
  37. package/dist/services/log.service.js +572 -0
  38. package/dist/services/log.service.js.map +1 -0
  39. package/dist/services/log.storage.base.service.d.ts +77 -0
  40. package/dist/services/log.storage.base.service.d.ts.map +1 -0
  41. package/dist/services/log.storage.base.service.js +107 -0
  42. package/dist/services/log.storage.base.service.js.map +1 -0
  43. package/dist/services/log.storage.external.s3.service.d.ts +66 -0
  44. package/dist/services/log.storage.external.s3.service.d.ts.map +1 -0
  45. package/dist/services/log.storage.external.s3.service.js +121 -0
  46. package/dist/services/log.storage.external.s3.service.js.map +1 -0
  47. package/dist/services/log.storage.external.service.d.ts +17 -0
  48. package/dist/services/log.storage.external.service.d.ts.map +1 -0
  49. package/dist/services/log.storage.external.service.js +22 -0
  50. package/dist/services/log.storage.external.service.js.map +1 -0
  51. package/dist/services/log.storage.local.service.d.ts +38 -0
  52. package/dist/services/log.storage.local.service.d.ts.map +1 -0
  53. package/dist/services/log.storage.local.service.js +96 -0
  54. package/dist/services/log.storage.local.service.js.map +1 -0
  55. package/dist/services/log.storage.service.d.ts +62 -0
  56. package/dist/services/log.storage.service.d.ts.map +1 -0
  57. package/dist/services/log.storage.service.js +92 -0
  58. package/dist/services/log.storage.service.js.map +1 -0
  59. package/dist/types/log.context.type.d.ts +74 -0
  60. package/dist/types/log.context.type.d.ts.map +1 -0
  61. package/dist/types/log.context.type.js +3 -0
  62. package/dist/types/log.context.type.js.map +1 -0
  63. package/dist/types/log.type.d.ts +45 -0
  64. package/dist/types/log.type.d.ts.map +1 -0
  65. package/dist/types/log.type.js +3 -0
  66. package/dist/types/log.type.js.map +1 -0
  67. package/package.json +64 -0
@@ -0,0 +1,572 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LogService = void 0;
4
+ const uuid_1 = require("uuid");
5
+ const log_service_config_1 = require("../configs/log.service.config");
6
+ const log_storage_service_1 = require("./log.storage.service");
7
+ const log_error_1 = require("../errors/log.error");
8
+ /**
9
+ * Class LogService
10
+ *
11
+ * Responsible for logging messages with different severity levels
12
+ *
13
+ * @property {LogServiceConfigInterface} config
14
+ * @property {LogStorageService} logStorageService
15
+ * @property {string} correlationId
16
+ * @property {Promise<void>} writeQueue
17
+ */
18
+ class LogService {
19
+ /**
20
+ * Sets the correlation ID for log entries
21
+ *
22
+ * @param {string} correlationId
23
+ *
24
+ * @returns {void}
25
+ */
26
+ static setCorrelationId(correlationId) {
27
+ this.correlationId = correlationId ?? (0, uuid_1.v4)();
28
+ }
29
+ /**
30
+ * Gets the current correlation ID
31
+ *
32
+ * @returns {string} The current correlation ID
33
+ */
34
+ static getCorrelationId() {
35
+ return this.correlationId;
36
+ }
37
+ /**
38
+ * Determines if a log message should be logged based on its level
39
+ *
40
+ * @param {LogType['level']} level The level of the log message
41
+ *
42
+ * @returns {boolean} True if the message should be logged, false otherwise
43
+ */
44
+ static shouldLog(level) {
45
+ if (!this.config.useLog) {
46
+ return false;
47
+ }
48
+ const levels = [
49
+ 'error',
50
+ 'warn',
51
+ 'info',
52
+ 'debug'
53
+ ];
54
+ const configLevelIndex = levels.indexOf(this.config.level);
55
+ const messageLevel = levels.indexOf(level);
56
+ return messageLevel <= configLevelIndex;
57
+ }
58
+ /**
59
+ * Formats the log data into a string
60
+ *
61
+ * @param {LogType} data The log data to format
62
+ *
63
+ * @returns {string} The formatted log string
64
+ */
65
+ static formatLog(data) {
66
+ return JSON.stringify(data);
67
+ }
68
+ /**
69
+ * Gets the current timestamp
70
+ *
71
+ * @returns {string} The current timestamp
72
+ */
73
+ static getTimestamp() {
74
+ return this.config.timestampFormat === 'iso'
75
+ ? new Date().toISOString()
76
+ : Date.now().toString();
77
+ }
78
+ /**
79
+ * Colorizes the log text based on the log level
80
+ *
81
+ * @param {LogType['level']} data The log level
82
+ *
83
+ * @returns {string} The colorized log text
84
+ */
85
+ static colorizeLogOutput(data) {
86
+ const logOutput = this.formatLog(data);
87
+ if (!this.config.useColors) {
88
+ return logOutput;
89
+ }
90
+ /**
91
+ * ANSI color codes
92
+ *
93
+ * @error red
94
+ * @warn yellow
95
+ * @info cyan
96
+ * @debug gray
97
+ */
98
+ const colors = {
99
+ error: '\x1b[31m',
100
+ warn: '\x1b[33m',
101
+ info: '\x1b[36m',
102
+ debug: '\x1b[90m'
103
+ };
104
+ const reset = '\x1b[0m';
105
+ return `${colors[data.level]}${logOutput}${reset}`;
106
+ }
107
+ /**
108
+ * Creates a log entry
109
+ *
110
+ * @param {LogType['level']} level The log level
111
+ * @param {string} message The log message
112
+ * @param {LogContextType} context The log context
113
+ *
114
+ * @returns {LogType} The created log entry
115
+ */
116
+ static createLogEntry(level, message, context) {
117
+ return {
118
+ timestamp: this.getTimestamp(),
119
+ level,
120
+ environment: this.config.environment,
121
+ service: this.config.service,
122
+ correlation_id: this.correlationId,
123
+ message: `${this.config.logPrefix} ${message}`,
124
+ context
125
+ };
126
+ }
127
+ /**
128
+ * Logs an informational message
129
+ *
130
+ * @param {string} message The log message
131
+ * @param {LogContextType} context The log context
132
+ *
133
+ * @returns {void}
134
+ */
135
+ static info(message, context) {
136
+ if (!this.shouldLog('info')) {
137
+ return;
138
+ }
139
+ const log = this.createLogEntry('info', message, context);
140
+ this.writeLog(log);
141
+ }
142
+ /**
143
+ * Logs a warning message
144
+ *
145
+ * @param {string} message The warning message
146
+ * @param {LogContextType} context The log context
147
+ *
148
+ * @returns {void}
149
+ */
150
+ static warn(message, context) {
151
+ if (!this.shouldLog('warn')) {
152
+ return;
153
+ }
154
+ const log = this.createLogEntry('warn', message, context);
155
+ this.writeLog(log);
156
+ }
157
+ /**
158
+ * Logs an error message
159
+ *
160
+ * @param {string} message The error message
161
+ * @param {LogContextType} context The log context
162
+ *
163
+ * @returns {void}
164
+ */
165
+ static error(message, context) {
166
+ if (!this.shouldLog('error')) {
167
+ return;
168
+ }
169
+ const log = this.createLogEntry('error', message, context);
170
+ this.writeLog(log);
171
+ }
172
+ /**
173
+ * Logs a debug message
174
+ *
175
+ * @param {string} message The debug message
176
+ * @param {LogContextType} context The log context
177
+ *
178
+ * @returns {void}
179
+ */
180
+ static debug(message, context) {
181
+ if (!this.shouldLog('debug')) {
182
+ return;
183
+ }
184
+ const log = this.createLogEntry('debug', message, context);
185
+ this.writeLog(log);
186
+ }
187
+ /**
188
+ * Function to sanitize sensitive data
189
+ *
190
+ * @param {any} body
191
+ *
192
+ * @returns {any}
193
+ */
194
+ static sanitizeBody(body) {
195
+ if (!body) {
196
+ return body;
197
+ }
198
+ if (typeof body === 'string') {
199
+ try {
200
+ body = JSON.parse(body);
201
+ }
202
+ catch {
203
+ return body.length > this.config.maxBodySize
204
+ ? `${body.substring(0, this.config.maxBodySize)}... [TRUNCATED]`
205
+ : body;
206
+ }
207
+ }
208
+ if (typeof body !== 'object') {
209
+ return body;
210
+ }
211
+ /**
212
+ * Recursively sanitize an object
213
+ *
214
+ * @param {LogServiceConfigInterface} config The log service configuration
215
+ * @param {any} obj The object to sanitize
216
+ * @param {WeakSet} visited Set to track visited objects and prevent circular references
217
+ *
218
+ * @returns {any} The sanitized object
219
+ */
220
+ function sanitizeRecursive(config, obj, visited = new WeakSet()) {
221
+ if (obj
222
+ && typeof obj === 'object'
223
+ && visited.has(obj)) {
224
+ return '[CIRCULAR REFERENCE]';
225
+ }
226
+ if (Array.isArray(obj)) {
227
+ visited.add(obj);
228
+ return obj.map(item => sanitizeRecursive(config, item, visited));
229
+ }
230
+ if (obj
231
+ && typeof obj === 'object') {
232
+ visited.add(obj);
233
+ const result = {};
234
+ for (const [key, value] of Object.entries(obj)) {
235
+ if (config.sensitiveFields.some(field => key.toLowerCase().includes(field.toLowerCase()))) {
236
+ result[key] = '[REDACTED]';
237
+ }
238
+ else if (typeof value === 'object') {
239
+ result[key] = sanitizeRecursive(config, value, visited);
240
+ }
241
+ else {
242
+ result[key] = value;
243
+ }
244
+ }
245
+ return result;
246
+ }
247
+ return obj;
248
+ }
249
+ if (Array.isArray(body)) {
250
+ return body.map(item => sanitizeRecursive(this.config, item));
251
+ }
252
+ const sanitized = { ...body };
253
+ const sanitizedResult = sanitizeRecursive(this.config, sanitized);
254
+ const stringified = JSON.stringify(sanitizedResult);
255
+ if (stringified.length > this.config.maxBodySize) {
256
+ const truncated = stringified.substring(0, this.config.maxBodySize);
257
+ return `${truncated}... [TRUNCATED]`;
258
+ }
259
+ return sanitizedResult;
260
+ }
261
+ /**
262
+ * Get the client IP address from the request
263
+ *
264
+ * @param {Request} request The Express request object
265
+ *
266
+ * @returns {string} The client IP address
267
+ */
268
+ static getClientIp(request) {
269
+ return request?.ip
270
+ || request?.connection?.remoteAddress
271
+ || request?.socket?.remoteAddress
272
+ || request?.connection?.socket?.remoteAddress
273
+ || request?.headers['x-forwarded-for']?.toString().split(',')[0]?.trim()
274
+ || request?.headers['x-real-ip']?.toString()
275
+ || '127.0.0.1';
276
+ }
277
+ /**
278
+ * Writes log data to the configured destinations (console, storage, or both)
279
+ *
280
+ * @param {LogType} data The log data to write
281
+ *
282
+ * @returns {void}
283
+ */
284
+ static writeLog(data) {
285
+ const config = this.config;
286
+ if ([
287
+ 'console',
288
+ 'both'
289
+ ].includes(config.logDestination)) {
290
+ this.writeToConsole(data);
291
+ }
292
+ if ([
293
+ 'storage',
294
+ 'both'
295
+ ].includes(config.logDestination)) {
296
+ this.writeQueue = this.writeQueue.then(async () => {
297
+ try {
298
+ await this.writeToStorage(data);
299
+ }
300
+ catch (error) {
301
+ console.error('Error writing log to storage, falling back to console log:', error);
302
+ this.writeToConsole(data);
303
+ }
304
+ }).catch(error => {
305
+ console.error('Error in log queue:', error);
306
+ });
307
+ }
308
+ }
309
+ /**
310
+ * Initializes the LoggingStorageService if not already initialized
311
+ *
312
+ * @returns {void}
313
+ */
314
+ static initializeLogStorageService() {
315
+ if (!this.logStorageService) {
316
+ try {
317
+ this.logStorageService = new log_storage_service_1.LogStorageService(this.config);
318
+ }
319
+ catch (error) {
320
+ console.error('Failed to initialize LogStorageService:', error);
321
+ this.logStorageService = null;
322
+ }
323
+ }
324
+ }
325
+ /**
326
+ * Writes log data to the appropriate storage (file or S3)
327
+ *
328
+ * @param {LogType} data The log data to write
329
+ *
330
+ * @returns {Promise<void>}
331
+ */
332
+ static async writeToStorage(data) {
333
+ this.initializeLogStorageService();
334
+ if (this.logStorageService) {
335
+ await this.logStorageService.write(data);
336
+ }
337
+ }
338
+ /**
339
+ * Writes log data to the console with appropriate color coding
340
+ *
341
+ * @param {LogType} data The log data to write
342
+ *
343
+ * @returns {void}
344
+ */
345
+ static writeToConsole(data) {
346
+ switch (data.level) {
347
+ case 'info':
348
+ console.info(this.colorizeLogOutput(data));
349
+ break;
350
+ case 'warn':
351
+ console.warn(this.colorizeLogOutput(data));
352
+ break;
353
+ case 'error':
354
+ console.error(this.colorizeLogOutput(data));
355
+ break;
356
+ case 'debug':
357
+ console.debug(this.colorizeLogOutput(data));
358
+ break;
359
+ }
360
+ }
361
+ /**
362
+ * Helper method to execute request calls with logging
363
+ *
364
+ * @param {() => Promise<any>} requestCall - The request call function
365
+ * @param {string} requestMethod - The HTTP method (GET, POST, etc.)
366
+ * @param {string} requestUrl - The request endpoint URL
367
+ * @param {string} requestName - The name of the external request for logging purposes
368
+ * @param {any} requestBody - The request body (if applicable)
369
+ * @param {Request} requestOrigin - The original Express request
370
+ *
371
+ * @returns {Promise<T>} - The request response
372
+ */
373
+ static async executeRequestWithLogging(requestCall, requestMethod, requestUrl, requestName, requestBody, requestOrigin) {
374
+ const startTime = Date.now();
375
+ try {
376
+ const response = await requestCall();
377
+ const duration = Date.now() - startTime;
378
+ this.logExternalRequestCall(requestMethod, requestUrl, requestName, requestOrigin, requestBody, response.status, duration, response.data);
379
+ return response;
380
+ }
381
+ catch (error) {
382
+ const duration = Date.now() - startTime;
383
+ const statusCode = error?.response?.status || 500;
384
+ const errorMessage = error?.response?.data?.message || 'Internal error';
385
+ const responseBody = error?.response?.data || {};
386
+ this.logExternalRequestCall(requestMethod, requestUrl, requestName, requestBody, requestOrigin, statusCode, duration, responseBody, error);
387
+ throw new log_error_1.LogError(errorMessage, statusCode);
388
+ }
389
+ }
390
+ /**
391
+ * Logs an external request call
392
+ *
393
+ * @param {string} requestMethod
394
+ * @param {string} requestUrl
395
+ * @param {string} requestName
396
+ * @param {Request} requestOrigin
397
+ * @param {any} requestBody
398
+ * @param {number} statusCode
399
+ * @param {number} duration
400
+ * @param {any} responseBody
401
+ * @param {Error} error
402
+ *
403
+ * @returns {void}
404
+ */
405
+ static logExternalRequestCall(requestMethod, requestUrl, requestName, requestOrigin, requestBody, statusCode, duration, responseBody, error) {
406
+ if (this.config.logExternalRequestCalls !== true) {
407
+ return;
408
+ }
409
+ const additionalData = {
410
+ method: requestMethod,
411
+ url: requestUrl,
412
+ request: this.sanitizeBody(requestBody),
413
+ response: this.sanitizeBody(responseBody),
414
+ response_time: duration
415
+ };
416
+ let context;
417
+ if (requestOrigin) {
418
+ context = this.createContextFromRequest(requestOrigin, additionalData);
419
+ }
420
+ else {
421
+ context = this.createContextFromData(additionalData);
422
+ }
423
+ const message = 'External request call'
424
+ + (requestName
425
+ ? ` to ${requestName}`
426
+ : '');
427
+ if (error) {
428
+ this.error(`${message} failed: ${error.message}`, {
429
+ ...context,
430
+ error: error.message,
431
+ stack: error.stack,
432
+ status_code: statusCode
433
+ });
434
+ }
435
+ else {
436
+ this.info(`${message} completed`, {
437
+ ...context,
438
+ status_code: statusCode
439
+ });
440
+ }
441
+ }
442
+ /**
443
+ * Creates a log context from an Express request
444
+ *
445
+ * @param {Request} request The Express request
446
+ * @param {Partial<LogContextType>} additionalData Additional data to include in the context
447
+ *
448
+ * @returns {LogContextType} The created log context
449
+ */
450
+ static createContextFromRequest(request, additionalData) {
451
+ const context = {};
452
+ if (this.config.includeRequestHeaders) {
453
+ context.headers = {
454
+ 'content-type': request.get('Content-Type'),
455
+ 'authorization': request.get('Authorization')
456
+ ? '[REDACTED]'
457
+ : undefined,
458
+ 'x-forwarded-for': request.get('X-Forwarded-For'),
459
+ 'accept': request.get('Accept'),
460
+ 'api-token': request.get('api-token')
461
+ ? '[REDACTED]'
462
+ : undefined,
463
+ 'app-id': request.get('app-id')
464
+ ? '[REDACTED]'
465
+ : undefined,
466
+ };
467
+ }
468
+ if (this.config.includeRequestBody) {
469
+ context.content_type = request.get('Content-Type') || '';
470
+ if (context.content_type.includes('multipart/form-data')) {
471
+ context.request = {
472
+ type: 'multipart/form-data',
473
+ note: 'Details will be logged after processing'
474
+ };
475
+ }
476
+ else if (request.body
477
+ && Object.keys(request.body).length > 0) {
478
+ context.request = this.sanitizeBody(request.body);
479
+ }
480
+ }
481
+ return {
482
+ ...context,
483
+ method: request.method,
484
+ url: request.originalUrl || request.url,
485
+ user_agent: request.get('User-Agent'),
486
+ ip: this.getClientIp(request),
487
+ ...additionalData
488
+ };
489
+ }
490
+ /**
491
+ * Creates a log context from an Express response
492
+ *
493
+ * @param {Request} request The Express request object
494
+ * @param {Response} response The Express response object
495
+ * @param {Partial<LogContextType>} additionalData Additional data to include in the context
496
+ *
497
+ * @returns {LogContextType} The created log context
498
+ */
499
+ static createContextFromResponse(request, response, additionalData) {
500
+ const context = this.createContextFromRequest(request);
501
+ context.status_code = response.statusCode;
502
+ if (this.config.includeResponseBody) {
503
+ context.response = this.sanitizeBody(additionalData?.response || response);
504
+ }
505
+ const contentType = context.content_type || '';
506
+ if (this.config.includeRequestBody
507
+ && contentType.includes('multipart/form-data')) {
508
+ const multipartData = {
509
+ type: 'multipart/form-data'
510
+ };
511
+ if (request.body
512
+ && Object.keys(request.body).length > 0) {
513
+ multipartData.fields = this.sanitizeBody(request.body);
514
+ }
515
+ if (request.file) {
516
+ multipartData.file = {
517
+ field_name: request.file.fieldname,
518
+ original_name: request.file.originalname,
519
+ mime_type: request.file.mimetype,
520
+ size: request.file.size
521
+ };
522
+ }
523
+ if (request.files
524
+ && Array.isArray(request.files)) {
525
+ multipartData.files = request.files.map((file) => ({
526
+ field_name: file.fieldname,
527
+ original_name: file.originalname,
528
+ mime_type: file.mimetype,
529
+ size: file.size
530
+ }));
531
+ }
532
+ context.request = multipartData;
533
+ }
534
+ return {
535
+ ...context,
536
+ ...additionalData,
537
+ };
538
+ }
539
+ /**
540
+ * Creates a log context from arbitrary data
541
+ *
542
+ * @param {Partial<LogContextType>} data The data to create the context from
543
+ *
544
+ * @returns {LogContextType} The created log context
545
+ */
546
+ static createContextFromData(data) {
547
+ return {
548
+ method: 'unknown',
549
+ url: 'unknown',
550
+ ip: this.getClientIp(),
551
+ ...(data ?? {})
552
+ };
553
+ }
554
+ }
555
+ exports.LogService = LogService;
556
+ /**
557
+ * @var {LogServiceConfigInterface}
558
+ */
559
+ LogService.config = (0, log_service_config_1.getLogServiceConfig)();
560
+ /**
561
+ * @var {string}
562
+ */
563
+ LogService.correlationId = (0, uuid_1.v4)();
564
+ /**
565
+ * @var {LogStorageService|null}
566
+ */
567
+ LogService.logStorageService = null;
568
+ /**
569
+ * @var {Promise<void>}
570
+ */
571
+ LogService.writeQueue = Promise.resolve();
572
+ //# sourceMappingURL=log.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.service.js","sourceRoot":"","sources":["../../src/services/log.service.ts"],"names":[],"mappings":";;;AACA,+BAAoC;AACpC,sEAAoE;AAEpE,+DAA0D;AAG1D,mDAA+C;AAE/C;;;;;;;;;GASG;AACH,MAAa,UAAU;IAsBrB;;;;;;OAMG;IACI,MAAM,CAAC,gBAAgB,CAAC,aAAsB;QAEnD,IAAI,CAAC,aAAa,GAAG,aAAa,IAAI,IAAA,SAAM,GAAE,CAAC;IACjD,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,gBAAgB;QAE5B,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;;;;;;OAMG;IACK,MAAM,CAAC,SAAS,CAAC,KAAuB;QAE9C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC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EzE;;GAEG;AACY,wBAAa,GAAW,IAAA,SAAM,GAAE,CAAC;AAEhD;;GAEG;AACY,4BAAiB,GAA6B,IAAI,CAAC;AAElE;;GAEG;AACY,qBAAU,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC"}
@@ -0,0 +1,77 @@
1
+ import { LogStorageBaseServiceInterface } from '../interfaces/log.storage.base.service.interface';
2
+ import { LogServiceConfigInterface } from '../interfaces/log.service.config.interface';
3
+ import { LogType } from '../types/log.type';
4
+ /**
5
+ * Abstract Class LogStorageBaseService
6
+ *
7
+ * Base class for logging storage target services (e.g., local file system, S3)
8
+ *
9
+ * @property {LogServiceConfigInterface} logServiceConfig
10
+ * @property {string} baseLogsDirectory
11
+ */
12
+ export declare abstract class LogStorageBaseService implements LogStorageBaseServiceInterface {
13
+ /**
14
+ * @var {string}
15
+ */
16
+ protected baseLogsDirectory: string;
17
+ /**
18
+ * @var {LogServiceConfigInterface}
19
+ */
20
+ protected logServiceConfig: LogServiceConfigInterface;
21
+ /**
22
+ * Constructor of the LogStorageTargetService
23
+ *
24
+ * @param logServiceConfig - Configuration for the logging service
25
+ * @param baseLogsDirectory - Base directory for storing logs
26
+ */
27
+ constructor(logServiceConfig: LogServiceConfigInterface, baseLogsDirectory: string);
28
+ /**
29
+ * Gets the logs directory for the current environment
30
+ *
31
+ * @returns {string} The environment-specific logs directory
32
+ */
33
+ protected getLogsDirectory(): string;
34
+ /**
35
+ * Gets the combined log file name for the current date
36
+ *
37
+ * @returns {string} The combined log file name
38
+ */
39
+ private getCombinedLogFileName;
40
+ /**
41
+ * Gets the combined log file path
42
+ *
43
+ * @returns {string} The combined log file path
44
+ */
45
+ protected getCombinedLogFilePath(): string;
46
+ /**
47
+ * Gets the log file name for the date and level
48
+ *
49
+ * @param {LogType['level']} level The log level
50
+ *
51
+ * @returns {string} The log file name
52
+ */
53
+ private getLevelLogFileName;
54
+ /**
55
+ * Gets the log file name for the date and level
56
+ *
57
+ * @param {LogType['level']} level The log level
58
+ *
59
+ * @returns {string} The log file path
60
+ */
61
+ protected getLevelLogFilePath(level: LogType['level']): string;
62
+ /**
63
+ * Writes log data to the storage
64
+ *
65
+ * @param {LogType} data - Log data to be written
66
+ *
67
+ * @returns {Promise<void>}
68
+ */
69
+ abstract write(data: LogType): Promise<void>;
70
+ /**
71
+ * Indicates if the storage target should be used
72
+ *
73
+ * @returns {boolean} True if the storage target should be used, false otherwise
74
+ */
75
+ abstract shouldUse(): boolean;
76
+ }
77
+ //# sourceMappingURL=log.storage.base.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.storage.base.service.d.ts","sourceRoot":"","sources":["../../src/services/log.storage.base.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,kDAAkD,CAAC;AAClG,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C;;;;;;;GAOG;AACH,8BAAsB,qBAAsB,YAAW,8BAA8B;IAEnF;;OAEG;IACH,SAAS,CAAC,iBAAiB,EAAE,MAAM,CAAC;IAEpC;;OAEG;IACH,SAAS,CAAC,gBAAgB,EAAE,yBAAyB,CAAC;IAEtD;;;;;OAKG;gBAED,gBAAgB,EAAE,yBAAyB,EAC3C,iBAAiB,EAAE,MAAM;IAM3B;;;;OAIG;IACH,SAAS,CAAC,gBAAgB,IAAI,MAAM;IAQpC;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAQ9B;;;;OAIG;IACH,SAAS,CAAC,sBAAsB,IAAI,MAAM;IAQ1C;;;;;;OAMG;IACH,OAAO,CAAC,mBAAmB;IAQ3B;;;;;;OAMG;IACH,SAAS,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,MAAM;IAQ9D;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAE5C;;;;OAIG;IACH,QAAQ,CAAC,SAAS,IAAI,OAAO;CAC9B"}