@tmlmobilidade/utils 20250901.2024.56 → 20250901.2033.7
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/dist/src/logs/logs.d.ts +15 -7
- package/dist/src/logs/logs.js +16 -7
- package/package.json +1 -1
package/dist/src/logs/logs.d.ts
CHANGED
|
@@ -12,20 +12,19 @@ interface LogColumn {
|
|
|
12
12
|
*/
|
|
13
13
|
txt: string;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
* Logger class for structured logging.
|
|
17
|
-
*/
|
|
18
|
-
export declare class Logs {
|
|
15
|
+
declare class LogsClass {
|
|
19
16
|
/**
|
|
20
17
|
* Logs a divider line in the console.
|
|
21
18
|
* @param message Optional message to display.
|
|
22
|
-
* @param size Width of the divider line.
|
|
19
|
+
* @param size Width of the divider line. Default is `75`.
|
|
23
20
|
*/
|
|
24
21
|
divider(message?: string, size?: number): void;
|
|
25
22
|
/**
|
|
26
23
|
* Logs an error message in the console.
|
|
27
24
|
* @param message Error message to display.
|
|
28
25
|
* @param error Optional error object to display.
|
|
26
|
+
* @param spacesAfter Optional number of blank lines to add after the message.
|
|
27
|
+
* @param spacesBefore Optional number of blank lines to add before the message.
|
|
29
28
|
*/
|
|
30
29
|
error(message: string, error?: Error, spacesAfter?: number, spacesBefore?: number): void;
|
|
31
30
|
/**
|
|
@@ -48,9 +47,9 @@ export declare class Logs {
|
|
|
48
47
|
progress(message: LogColumn[] | string, spacesAfter?: number, spacesBefore?: number): void;
|
|
49
48
|
/**
|
|
50
49
|
* Logs a spacer line in the console.
|
|
51
|
-
* @param lines Number of blank lines to add.
|
|
50
|
+
* @param lines Number of blank lines to add. Default is `1`.
|
|
52
51
|
*/
|
|
53
|
-
spacer(lines
|
|
52
|
+
spacer(lines?: number): void;
|
|
54
53
|
/**
|
|
55
54
|
* Logs a success message in the console.
|
|
56
55
|
* @param message Success message to display.
|
|
@@ -68,6 +67,15 @@ export declare class Logs {
|
|
|
68
67
|
* @param message Title message to display.
|
|
69
68
|
*/
|
|
70
69
|
title(message: string): void;
|
|
70
|
+
/**
|
|
71
|
+
* Formats an array of log columns or strings into a single string.
|
|
72
|
+
* @param columns Array of log columns or strings to format.
|
|
73
|
+
* @returns Formatted string.
|
|
74
|
+
*/
|
|
71
75
|
private formatColumns;
|
|
72
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Logger class for structured logging.
|
|
79
|
+
*/
|
|
80
|
+
export declare const Logs: LogsClass;
|
|
73
81
|
export {};
|
package/dist/src/logs/logs.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/* * */
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
export class Logs {
|
|
2
|
+
/* * */
|
|
3
|
+
class LogsClass {
|
|
6
4
|
//
|
|
7
5
|
/**
|
|
8
6
|
* Logs a divider line in the console.
|
|
9
7
|
* @param message Optional message to display.
|
|
10
|
-
* @param size Width of the divider line.
|
|
8
|
+
* @param size Width of the divider line. Default is `75`.
|
|
11
9
|
*/
|
|
12
10
|
divider(message, size = 75) {
|
|
13
11
|
console.log();
|
|
@@ -21,6 +19,8 @@ export class Logs {
|
|
|
21
19
|
* Logs an error message in the console.
|
|
22
20
|
* @param message Error message to display.
|
|
23
21
|
* @param error Optional error object to display.
|
|
22
|
+
* @param spacesAfter Optional number of blank lines to add after the message.
|
|
23
|
+
* @param spacesBefore Optional number of blank lines to add before the message.
|
|
24
24
|
*/
|
|
25
25
|
error(message, error, spacesAfter, spacesBefore) {
|
|
26
26
|
if (spacesBefore && spacesBefore > 0)
|
|
@@ -77,9 +77,9 @@ export class Logs {
|
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* Logs a spacer line in the console.
|
|
80
|
-
* @param lines Number of blank lines to add.
|
|
80
|
+
* @param lines Number of blank lines to add. Default is `1`.
|
|
81
81
|
*/
|
|
82
|
-
spacer(lines) {
|
|
82
|
+
spacer(lines = 1) {
|
|
83
83
|
for (let i = 0; i < lines; i++) {
|
|
84
84
|
console.log();
|
|
85
85
|
}
|
|
@@ -120,6 +120,11 @@ export class Logs {
|
|
|
120
120
|
console.log(`▶︎ ${message}`);
|
|
121
121
|
console.log();
|
|
122
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Formats an array of log columns or strings into a single string.
|
|
125
|
+
* @param columns Array of log columns or strings to format.
|
|
126
|
+
* @returns Formatted string.
|
|
127
|
+
*/
|
|
123
128
|
formatColumns(columns) {
|
|
124
129
|
return columns
|
|
125
130
|
.map((item) => {
|
|
@@ -134,3 +139,7 @@ export class Logs {
|
|
|
134
139
|
.join(' ');
|
|
135
140
|
}
|
|
136
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Logger class for structured logging.
|
|
144
|
+
*/
|
|
145
|
+
export const Logs = new LogsClass();
|
package/package.json
CHANGED