@eqxjs/nest-logger 3.1.0-beta.13 → 3.1.0-beta.14
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 +646 -78
- package/dist/constants/action-message.constant.d.ts +171 -0
- package/dist/constants/action-message.constant.js +171 -0
- package/dist/constants/action-message.constant.js.map +1 -1
- package/dist/core/formatters/logger.formatter.d.ts +107 -0
- package/dist/core/formatters/logger.formatter.js +107 -0
- package/dist/core/formatters/logger.formatter.js.map +1 -1
- package/dist/core/loggers/app.logger.d.ts +33 -0
- package/dist/core/loggers/app.logger.js +51 -0
- package/dist/core/loggers/app.logger.js.map +1 -1
- package/dist/core/loggers/custom.logger.d.ts +111 -0
- package/dist/core/loggers/custom.logger.js +119 -0
- package/dist/core/loggers/custom.logger.js.map +1 -1
- package/dist/helpers/datetime.helper.d.ts +23 -0
- package/dist/helpers/datetime.helper.js +23 -0
- package/dist/helpers/datetime.helper.js.map +1 -1
- package/dist/helpers/log.helper.d.ts +81 -0
- package/dist/helpers/log.helper.js +81 -0
- package/dist/helpers/log.helper.js.map +1 -1
- package/dist/helpers/logger-builder.helper.d.ts +207 -2
- package/dist/helpers/logger-builder.helper.js +207 -2
- package/dist/helpers/logger-builder.helper.js.map +1 -1
- package/dist/helpers/message-formatter.helper.d.ts +74 -7
- package/dist/helpers/message-formatter.helper.js +74 -7
- package/dist/helpers/message-formatter.helper.js.map +1 -1
- package/dist/helpers/time-performance.helper.d.ts +61 -0
- package/dist/helpers/time-performance.helper.js +62 -1
- package/dist/helpers/time-performance.helper.js.map +1 -1
- package/dist/models/logger.dto.d.ts +43 -0
- package/dist/models/logger.dto.js +43 -0
- package/dist/models/logger.dto.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,20 +1,87 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Formats a message of any type to string representation.
|
|
3
|
+
*
|
|
4
|
+
* Optimized for performance with fast paths for common cases (strings, numbers).
|
|
5
|
+
* Handles various input types:
|
|
6
|
+
* - Strings: returned as-is (fast path)
|
|
7
|
+
* - Numbers: converted to string
|
|
8
|
+
* - Functions: executed and result converted to string
|
|
9
|
+
* - null/undefined: returns empty string
|
|
10
|
+
* - Objects: JSON stringified with sensitive field masking
|
|
11
|
+
*
|
|
12
|
+
* @param message - The message to format (can be any type)
|
|
13
|
+
* @returns String representation of the message
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* formatMessage('Hello'); // "Hello"
|
|
18
|
+
* formatMessage(123); // "123"
|
|
19
|
+
* formatMessage({ key: 'value' }); // "{\"key\":\"value\"}"
|
|
20
|
+
* formatMessage(null); // ""
|
|
21
|
+
* formatMessage(() => 'computed'); // "computed"
|
|
22
|
+
* ```
|
|
4
23
|
*/
|
|
5
24
|
export declare function formatMessage(message: any): string;
|
|
6
25
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
26
|
+
* Returns the provided value or the default 'none' string if the value is empty.
|
|
27
|
+
*
|
|
28
|
+
* Optimized for performance with faster checks. Returns DEFAULT_VALUES.NONE if:
|
|
29
|
+
* - value is undefined
|
|
30
|
+
* - value is an empty string
|
|
31
|
+
* - value has length of 0
|
|
32
|
+
*
|
|
33
|
+
* @param value - The value to check (optional string)
|
|
34
|
+
* @returns The original value if non-empty, or DEFAULT_VALUES.NONE ('none')
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* setValueOrDefault('test'); // "test"
|
|
39
|
+
* setValueOrDefault(''); // "none"
|
|
40
|
+
* setValueOrDefault(undefined); // "none"
|
|
41
|
+
* setValueOrDefault(' '); // " " (whitespace is considered non-empty)
|
|
42
|
+
* ```
|
|
9
43
|
*/
|
|
10
44
|
export declare function setValueOrDefault(value?: string): string;
|
|
11
45
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
46
|
+
* Truncates a message if it exceeds the specified maximum length.
|
|
47
|
+
*
|
|
48
|
+
* Optimized with early return for messages within the limit. Adds '...' to indicate truncation.
|
|
49
|
+
* Uses DEFAULT_VALUES.MAX_MESSAGE_LENGTH as the default limit.
|
|
50
|
+
*
|
|
51
|
+
* @param message - The message string to truncate
|
|
52
|
+
* @param maxLength - Maximum allowed length (default: DEFAULT_VALUES.MAX_MESSAGE_LENGTH)
|
|
53
|
+
* @returns The original message if within limit, or truncated message with '...' appended
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* truncateMessage('Short', 100); // "Short"
|
|
58
|
+
* truncateMessage('A very long message...', 10); // "A very lon..."
|
|
59
|
+
* truncateMessage('Hello World'); // Uses default max length
|
|
60
|
+
* ```
|
|
14
61
|
*/
|
|
15
62
|
export declare function truncateMessage(message: string, maxLength?: number): string;
|
|
16
63
|
/**
|
|
17
|
-
*
|
|
64
|
+
* Merges broker information into a LoggerOpt object.
|
|
65
|
+
*
|
|
66
|
+
* Creates a new object with the broker field merged in. If opt is provided,
|
|
67
|
+
* spreads its properties and adds/overwrites the broker field. If opt is undefined,
|
|
68
|
+
* creates a new object with only the broker field.
|
|
69
|
+
*
|
|
70
|
+
* @param opt - Optional configuration object to merge with
|
|
71
|
+
* @param broker - Broker identifier to add to the configuration
|
|
72
|
+
* @returns New object with broker field merged in
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* // With existing options
|
|
77
|
+
* const opts = { customField: 'value' };
|
|
78
|
+
* mergeBrokerOption(opts, 'kafka');
|
|
79
|
+
* // Result: { customField: 'value', broker: 'kafka' }
|
|
80
|
+
*
|
|
81
|
+
* // Without existing options
|
|
82
|
+
* mergeBrokerOption(undefined, 'rabbitmq');
|
|
83
|
+
* // Result: { broker: 'rabbitmq' }
|
|
84
|
+
* ```
|
|
18
85
|
*/
|
|
19
86
|
export declare function mergeBrokerOption<T extends {
|
|
20
87
|
broker?: string;
|
|
@@ -40,8 +40,27 @@ exports.mergeBrokerOption = mergeBrokerOption;
|
|
|
40
40
|
const logger_constants_1 = require("../constants/logger.constants");
|
|
41
41
|
const logUtil = __importStar(require("./log.helper"));
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
43
|
+
* Formats a message of any type to string representation.
|
|
44
|
+
*
|
|
45
|
+
* Optimized for performance with fast paths for common cases (strings, numbers).
|
|
46
|
+
* Handles various input types:
|
|
47
|
+
* - Strings: returned as-is (fast path)
|
|
48
|
+
* - Numbers: converted to string
|
|
49
|
+
* - Functions: executed and result converted to string
|
|
50
|
+
* - null/undefined: returns empty string
|
|
51
|
+
* - Objects: JSON stringified with sensitive field masking
|
|
52
|
+
*
|
|
53
|
+
* @param message - The message to format (can be any type)
|
|
54
|
+
* @returns String representation of the message
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* formatMessage('Hello'); // "Hello"
|
|
59
|
+
* formatMessage(123); // "123"
|
|
60
|
+
* formatMessage({ key: 'value' }); // "{\"key\":\"value\"}"
|
|
61
|
+
* formatMessage(null); // ""
|
|
62
|
+
* formatMessage(() => 'computed'); // "computed"
|
|
63
|
+
* ```
|
|
45
64
|
*/
|
|
46
65
|
function formatMessage(message) {
|
|
47
66
|
// Fast path for most common case
|
|
@@ -63,15 +82,43 @@ function formatMessage(message) {
|
|
|
63
82
|
return logUtil.logStringify(message);
|
|
64
83
|
}
|
|
65
84
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
85
|
+
* Returns the provided value or the default 'none' string if the value is empty.
|
|
86
|
+
*
|
|
87
|
+
* Optimized for performance with faster checks. Returns DEFAULT_VALUES.NONE if:
|
|
88
|
+
* - value is undefined
|
|
89
|
+
* - value is an empty string
|
|
90
|
+
* - value has length of 0
|
|
91
|
+
*
|
|
92
|
+
* @param value - The value to check (optional string)
|
|
93
|
+
* @returns The original value if non-empty, or DEFAULT_VALUES.NONE ('none')
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* setValueOrDefault('test'); // "test"
|
|
98
|
+
* setValueOrDefault(''); // "none"
|
|
99
|
+
* setValueOrDefault(undefined); // "none"
|
|
100
|
+
* setValueOrDefault(' '); // " " (whitespace is considered non-empty)
|
|
101
|
+
* ```
|
|
68
102
|
*/
|
|
69
103
|
function setValueOrDefault(value) {
|
|
70
104
|
return (value && value.length > 0) ? value : logger_constants_1.DEFAULT_VALUES.NONE;
|
|
71
105
|
}
|
|
72
106
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
107
|
+
* Truncates a message if it exceeds the specified maximum length.
|
|
108
|
+
*
|
|
109
|
+
* Optimized with early return for messages within the limit. Adds '...' to indicate truncation.
|
|
110
|
+
* Uses DEFAULT_VALUES.MAX_MESSAGE_LENGTH as the default limit.
|
|
111
|
+
*
|
|
112
|
+
* @param message - The message string to truncate
|
|
113
|
+
* @param maxLength - Maximum allowed length (default: DEFAULT_VALUES.MAX_MESSAGE_LENGTH)
|
|
114
|
+
* @returns The original message if within limit, or truncated message with '...' appended
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* truncateMessage('Short', 100); // "Short"
|
|
119
|
+
* truncateMessage('A very long message...', 10); // "A very lon..."
|
|
120
|
+
* truncateMessage('Hello World'); // Uses default max length
|
|
121
|
+
* ```
|
|
75
122
|
*/
|
|
76
123
|
function truncateMessage(message, maxLength = logger_constants_1.DEFAULT_VALUES.MAX_MESSAGE_LENGTH) {
|
|
77
124
|
// Fast path: most messages are within limit
|
|
@@ -81,7 +128,27 @@ function truncateMessage(message, maxLength = logger_constants_1.DEFAULT_VALUES.
|
|
|
81
128
|
return message.substring(0, maxLength) + '...';
|
|
82
129
|
}
|
|
83
130
|
/**
|
|
84
|
-
*
|
|
131
|
+
* Merges broker information into a LoggerOpt object.
|
|
132
|
+
*
|
|
133
|
+
* Creates a new object with the broker field merged in. If opt is provided,
|
|
134
|
+
* spreads its properties and adds/overwrites the broker field. If opt is undefined,
|
|
135
|
+
* creates a new object with only the broker field.
|
|
136
|
+
*
|
|
137
|
+
* @param opt - Optional configuration object to merge with
|
|
138
|
+
* @param broker - Broker identifier to add to the configuration
|
|
139
|
+
* @returns New object with broker field merged in
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* // With existing options
|
|
144
|
+
* const opts = { customField: 'value' };
|
|
145
|
+
* mergeBrokerOption(opts, 'kafka');
|
|
146
|
+
* // Result: { customField: 'value', broker: 'kafka' }
|
|
147
|
+
*
|
|
148
|
+
* // Without existing options
|
|
149
|
+
* mergeBrokerOption(undefined, 'rabbitmq');
|
|
150
|
+
* // Result: { broker: 'rabbitmq' }
|
|
151
|
+
* ```
|
|
85
152
|
*/
|
|
86
153
|
function mergeBrokerOption(opt, broker) {
|
|
87
154
|
if (opt) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-formatter.helper.js","sourceRoot":"","sources":["../../src/helpers/message-formatter.helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"message-formatter.helper.js","sourceRoot":"","sources":["../../src/helpers/message-formatter.helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,sCAsBC;AAqBD,8CAEC;AAmBD,0CAMC;AAyBD,8CAQC;AAjID,oEAA+D;AAC/D,sDAAwC;AAExC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAgB,aAAa,CAAC,OAAY;IACxC,iCAAiC;IACjC,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,qBAAqB;IACrB,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IAED,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;QAClC,OAAO,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IAC3B,CAAC;IAED,wBAAwB;IACxB,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;QACpB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,sCAAsC;IACtC,OAAO,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;AACvC,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,iBAAiB,CAAC,KAAc;IAC9C,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,iCAAc,CAAC,IAAI,CAAC;AACnE,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,eAAe,CAAC,OAAe,EAAE,YAAoB,iCAAc,CAAC,kBAAkB;IACpG,4CAA4C;IAC5C,IAAI,OAAO,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC;QAChC,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC;AACjD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAgB,iBAAiB,CAC/B,GAAkB,EAClB,MAAe;IAEf,IAAI,GAAG,EAAE,CAAC;QACR,OAAO,EAAE,GAAG,GAAG,EAAE,MAAM,EAAE,CAAC;IAC5B,CAAC;IACD,OAAO,EAAE,MAAM,EAAO,CAAC;AACzB,CAAC"}
|
|
@@ -1,7 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TimeDiff - High-resolution timer for measuring elapsed time.
|
|
3
|
+
*
|
|
4
|
+
* Uses Node.js performance API to provide precise time measurements in milliseconds.
|
|
5
|
+
* Useful for tracking operation duration, performance monitoring, and logging service times.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const timer = new TimeDiff();
|
|
10
|
+
* await someOperation();
|
|
11
|
+
* const duration = timer.diff();
|
|
12
|
+
* console.log(`Operation took ${duration}ms`);
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // Using static start method
|
|
18
|
+
* const timer = TimeDiff.start();
|
|
19
|
+
* processData();
|
|
20
|
+
* console.log(`Elapsed: ${timer.end()}ms`);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
1
23
|
export declare class TimeDiff {
|
|
2
24
|
private startTime;
|
|
25
|
+
/**
|
|
26
|
+
* Creates a new TimeDiff instance and starts the timer.
|
|
27
|
+
* The start time is captured immediately using high-resolution performance timer.
|
|
28
|
+
*/
|
|
3
29
|
constructor();
|
|
30
|
+
/**
|
|
31
|
+
* Static factory method to create and start a new timer instance.
|
|
32
|
+
*
|
|
33
|
+
* @returns A new TimeDiff instance with the timer started
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const timer = TimeDiff.start();
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
4
40
|
static start(): TimeDiff;
|
|
41
|
+
/**
|
|
42
|
+
* Calculates and returns the elapsed time since the timer was started.
|
|
43
|
+
* Returns the duration in milliseconds with 3 decimal places precision.
|
|
44
|
+
*
|
|
45
|
+
* @returns Elapsed time in milliseconds (e.g., 123.456)
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const timer = new TimeDiff();
|
|
50
|
+
* await operation();
|
|
51
|
+
* const ms = timer.diff(); // e.g., 150.234
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
5
54
|
diff(): number;
|
|
55
|
+
/**
|
|
56
|
+
* Alias for diff() method. Returns the elapsed time since the timer was started.
|
|
57
|
+
*
|
|
58
|
+
* @returns Elapsed time in milliseconds
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* const timer = TimeDiff.start();
|
|
63
|
+
* processData();
|
|
64
|
+
* const duration = timer.end();
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
6
67
|
end(): number;
|
|
7
68
|
}
|
|
@@ -2,17 +2,78 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TimeDiff = void 0;
|
|
4
4
|
const perf_hooks_1 = require("perf_hooks");
|
|
5
|
+
/**
|
|
6
|
+
* TimeDiff - High-resolution timer for measuring elapsed time.
|
|
7
|
+
*
|
|
8
|
+
* Uses Node.js performance API to provide precise time measurements in milliseconds.
|
|
9
|
+
* Useful for tracking operation duration, performance monitoring, and logging service times.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const timer = new TimeDiff();
|
|
14
|
+
* await someOperation();
|
|
15
|
+
* const duration = timer.diff();
|
|
16
|
+
* console.log(`Operation took ${duration}ms`);
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Using static start method
|
|
22
|
+
* const timer = TimeDiff.start();
|
|
23
|
+
* processData();
|
|
24
|
+
* console.log(`Elapsed: ${timer.end()}ms`);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
5
27
|
class TimeDiff {
|
|
6
28
|
startTime;
|
|
29
|
+
/**
|
|
30
|
+
* Creates a new TimeDiff instance and starts the timer.
|
|
31
|
+
* The start time is captured immediately using high-resolution performance timer.
|
|
32
|
+
*/
|
|
7
33
|
constructor() {
|
|
8
34
|
this.startTime = perf_hooks_1.performance.now();
|
|
9
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Static factory method to create and start a new timer instance.
|
|
38
|
+
*
|
|
39
|
+
* @returns A new TimeDiff instance with the timer started
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* const timer = TimeDiff.start();
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
10
46
|
static start() {
|
|
11
47
|
return new TimeDiff();
|
|
12
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Calculates and returns the elapsed time since the timer was started.
|
|
51
|
+
* Returns the duration in milliseconds with 3 decimal places precision.
|
|
52
|
+
*
|
|
53
|
+
* @returns Elapsed time in milliseconds (e.g., 123.456)
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const timer = new TimeDiff();
|
|
58
|
+
* await operation();
|
|
59
|
+
* const ms = timer.diff(); // e.g., 150.234
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
13
62
|
diff() {
|
|
14
|
-
return
|
|
63
|
+
return parseFloat((perf_hooks_1.performance.now() - this.startTime).toFixed(3));
|
|
15
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Alias for diff() method. Returns the elapsed time since the timer was started.
|
|
67
|
+
*
|
|
68
|
+
* @returns Elapsed time in milliseconds
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* const timer = TimeDiff.start();
|
|
73
|
+
* processData();
|
|
74
|
+
* const duration = timer.end();
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
16
77
|
end() {
|
|
17
78
|
return this.diff();
|
|
18
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-performance.helper.js","sourceRoot":"","sources":["../../src/helpers/time-performance.helper.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAEzC,MAAa,QAAQ;IACX,SAAS,CAAS;IAE1B;QACE,IAAI,CAAC,SAAS,GAAG,wBAAW,CAAC,GAAG,EAAE,CAAC;IACrC,CAAC;
|
|
1
|
+
{"version":3,"file":"time-performance.helper.js","sourceRoot":"","sources":["../../src/helpers/time-performance.helper.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAEzC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,QAAQ;IACX,SAAS,CAAS;IAE1B;;;OAGG;IACH;QACE,IAAI,CAAC,SAAS,GAAG,wBAAW,CAAC,GAAG,EAAE,CAAC;IACrC,CAAC;IAED;;;;;;;;;OASG;IACI,MAAM,CAAC,KAAK;QACjB,OAAO,IAAI,QAAQ,EAAE,CAAC;IACxB,CAAC;IAED;;;;;;;;;;;;OAYG;IACI,IAAI;QACT,OAAO,UAAU,CAAC,CAAC,wBAAW,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IACrE,CAAC;IAED;;;;;;;;;;;OAWG;IACI,GAAG;QACR,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;IACrB,CAAC;CACF;AAzDD,4BAyDC"}
|
|
@@ -1,28 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LoggerDto - Data Transfer Object for structured log entries.
|
|
3
|
+
*
|
|
4
|
+
* Represents a complete log record with all metadata fields used throughout the logging system.
|
|
5
|
+
* This DTO is used to standardize log format across different logger types and ensure
|
|
6
|
+
* consistent structure for log aggregation, analysis, and monitoring.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const dto = new LoggerDto();
|
|
11
|
+
* dto.level = 'info';
|
|
12
|
+
* dto.timestamp = '2026-01-12T10:00:00.000Z';
|
|
13
|
+
* dto.message = 'User logged in';
|
|
14
|
+
* dto.appName = 'MyApp';
|
|
15
|
+
* dto.sessionId = 'sess-123';
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
1
18
|
export declare class LoggerDto {
|
|
19
|
+
/** Log level (e.g., 'debug', 'info', 'warn', 'error', 'verbose') */
|
|
2
20
|
level: string;
|
|
21
|
+
/** ISO 8601 formatted timestamp of the log entry */
|
|
3
22
|
timestamp: string;
|
|
23
|
+
/** Name of the application generating the log */
|
|
4
24
|
appName: string;
|
|
25
|
+
/** Name of the component or service within the application */
|
|
5
26
|
componentName: string;
|
|
27
|
+
/** Version of the component */
|
|
6
28
|
componentVersion: string;
|
|
29
|
+
/** Device identifier(s) - can be a single string or array of strings */
|
|
7
30
|
device: string | string[];
|
|
31
|
+
/** Action tag categorizing the log entry (e.g., '[HTTP_REQUEST]', '[DB_QUERY]') */
|
|
8
32
|
action: string;
|
|
33
|
+
/** The main log message content */
|
|
9
34
|
message: string;
|
|
35
|
+
/** Global unique identifier for the log entry */
|
|
10
36
|
guid: string;
|
|
37
|
+
/** Instance identifier (hostname, container ID, or pod name) */
|
|
11
38
|
instance: string;
|
|
39
|
+
/** Name of the service that originated the log */
|
|
12
40
|
originateServiceName: string;
|
|
41
|
+
/** Record identifier (e.g., order ID, user ID, transaction reference) */
|
|
13
42
|
recordName: string;
|
|
43
|
+
/** Type of record ('detail' for regular logs, 'summary' for aggregated logs) */
|
|
14
44
|
recordType: string;
|
|
45
|
+
/** Session identifier for tracking user sessions */
|
|
15
46
|
sessionId: string;
|
|
47
|
+
/** Transaction identifier for distributed tracing */
|
|
16
48
|
transactionId: string;
|
|
49
|
+
/** Public identifier(s) - can be a single string or array */
|
|
17
50
|
public: string | string[];
|
|
51
|
+
/** Message broker identifier (e.g., 'kafka', 'rabbitmq', 'redis') */
|
|
18
52
|
broker: string;
|
|
53
|
+
/** Communication channel (e.g., 'web', 'mobile', 'api', 'queue') */
|
|
19
54
|
channel: string;
|
|
55
|
+
/** Use case name being executed */
|
|
20
56
|
useCase: string;
|
|
57
|
+
/** Specific step within the use case */
|
|
21
58
|
useCaseStep: string;
|
|
59
|
+
/** User identifier (email, username, or user ID) */
|
|
22
60
|
user: string;
|
|
61
|
+
/** Application result description (e.g., 'Success', 'Failed', 'Completed') */
|
|
23
62
|
appResult: string;
|
|
63
|
+
/** Application result code (e.g., '200', '500', 'ERR_001') */
|
|
24
64
|
appResultCode: string;
|
|
65
|
+
/** Service processing time in milliseconds */
|
|
25
66
|
serviceTime: number;
|
|
67
|
+
/** Error stack trace as array of strings (populated for error logs) */
|
|
26
68
|
stack: string[];
|
|
69
|
+
/** DateTime string (alternative timestamp format, optional) */
|
|
27
70
|
dateTime?: string;
|
|
28
71
|
}
|
|
@@ -1,32 +1,75 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LoggerDto = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* LoggerDto - Data Transfer Object for structured log entries.
|
|
6
|
+
*
|
|
7
|
+
* Represents a complete log record with all metadata fields used throughout the logging system.
|
|
8
|
+
* This DTO is used to standardize log format across different logger types and ensure
|
|
9
|
+
* consistent structure for log aggregation, analysis, and monitoring.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const dto = new LoggerDto();
|
|
14
|
+
* dto.level = 'info';
|
|
15
|
+
* dto.timestamp = '2026-01-12T10:00:00.000Z';
|
|
16
|
+
* dto.message = 'User logged in';
|
|
17
|
+
* dto.appName = 'MyApp';
|
|
18
|
+
* dto.sessionId = 'sess-123';
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
4
21
|
class LoggerDto {
|
|
22
|
+
/** Log level (e.g., 'debug', 'info', 'warn', 'error', 'verbose') */
|
|
5
23
|
level;
|
|
24
|
+
/** ISO 8601 formatted timestamp of the log entry */
|
|
6
25
|
timestamp;
|
|
26
|
+
/** Name of the application generating the log */
|
|
7
27
|
appName;
|
|
28
|
+
/** Name of the component or service within the application */
|
|
8
29
|
componentName;
|
|
30
|
+
/** Version of the component */
|
|
9
31
|
componentVersion;
|
|
32
|
+
/** Device identifier(s) - can be a single string or array of strings */
|
|
10
33
|
device;
|
|
34
|
+
/** Action tag categorizing the log entry (e.g., '[HTTP_REQUEST]', '[DB_QUERY]') */
|
|
11
35
|
action;
|
|
36
|
+
/** The main log message content */
|
|
12
37
|
message;
|
|
38
|
+
/** Global unique identifier for the log entry */
|
|
13
39
|
guid;
|
|
40
|
+
/** Instance identifier (hostname, container ID, or pod name) */
|
|
14
41
|
instance;
|
|
42
|
+
/** Name of the service that originated the log */
|
|
15
43
|
originateServiceName;
|
|
44
|
+
/** Record identifier (e.g., order ID, user ID, transaction reference) */
|
|
16
45
|
recordName;
|
|
46
|
+
/** Type of record ('detail' for regular logs, 'summary' for aggregated logs) */
|
|
17
47
|
recordType;
|
|
48
|
+
/** Session identifier for tracking user sessions */
|
|
18
49
|
sessionId;
|
|
50
|
+
/** Transaction identifier for distributed tracing */
|
|
19
51
|
transactionId;
|
|
52
|
+
/** Public identifier(s) - can be a single string or array */
|
|
20
53
|
public;
|
|
54
|
+
/** Message broker identifier (e.g., 'kafka', 'rabbitmq', 'redis') */
|
|
21
55
|
broker;
|
|
56
|
+
/** Communication channel (e.g., 'web', 'mobile', 'api', 'queue') */
|
|
22
57
|
channel;
|
|
58
|
+
/** Use case name being executed */
|
|
23
59
|
useCase;
|
|
60
|
+
/** Specific step within the use case */
|
|
24
61
|
useCaseStep;
|
|
62
|
+
/** User identifier (email, username, or user ID) */
|
|
25
63
|
user;
|
|
64
|
+
/** Application result description (e.g., 'Success', 'Failed', 'Completed') */
|
|
26
65
|
appResult;
|
|
66
|
+
/** Application result code (e.g., '200', '500', 'ERR_001') */
|
|
27
67
|
appResultCode;
|
|
68
|
+
/** Service processing time in milliseconds */
|
|
28
69
|
serviceTime;
|
|
70
|
+
/** Error stack trace as array of strings (populated for error logs) */
|
|
29
71
|
stack;
|
|
72
|
+
/** DateTime string (alternative timestamp format, optional) */
|
|
30
73
|
dateTime;
|
|
31
74
|
}
|
|
32
75
|
exports.LoggerDto = LoggerDto;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.dto.js","sourceRoot":"","sources":["../../src/models/logger.dto.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAS;IACpB,KAAK,CAAU;
|
|
1
|
+
{"version":3,"file":"logger.dto.js","sourceRoot":"","sources":["../../src/models/logger.dto.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,SAAS;IACpB,oEAAoE;IACpE,KAAK,CAAU;IAEf,oDAAoD;IACpD,SAAS,CAAU;IAEnB,iDAAiD;IACjD,OAAO,CAAU;IAEjB,8DAA8D;IAC9D,aAAa,CAAU;IAEvB,+BAA+B;IAC/B,gBAAgB,CAAU;IAE1B,wEAAwE;IACxE,MAAM,CAAqB;IAE3B,mFAAmF;IACnF,MAAM,CAAU;IAEhB,mCAAmC;IACnC,OAAO,CAAU;IAEjB,iDAAiD;IACjD,IAAI,CAAU;IAEd,gEAAgE;IAChE,QAAQ,CAAU;IAElB,kDAAkD;IAClD,oBAAoB,CAAU;IAE9B,yEAAyE;IACzE,UAAU,CAAU;IAEpB,gFAAgF;IAChF,UAAU,CAAU;IAEpB,oDAAoD;IACpD,SAAS,CAAU;IAEnB,qDAAqD;IACrD,aAAa,CAAU;IAEvB,6DAA6D;IAC7D,MAAM,CAAqB;IAE3B,qEAAqE;IACrE,MAAM,CAAU;IAEhB,oEAAoE;IACpE,OAAO,CAAU;IAEjB,mCAAmC;IACnC,OAAO,CAAU;IAEjB,wCAAwC;IACxC,WAAW,CAAU;IAErB,oDAAoD;IACpD,IAAI,CAAU;IAEd,8EAA8E;IAC9E,SAAS,CAAU;IAEnB,8DAA8D;IAC9D,aAAa,CAAU;IAEvB,8CAA8C;IAC9C,WAAW,CAAU;IAErB,uEAAuE;IACvE,KAAK,CAAY;IAEjB,+DAA+D;IAC/D,QAAQ,CAAU;CACnB;AA9ED,8BA8EC"}
|