node-ansi-logger 1.9.5 → 2.0.1
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/LICENSE +20 -20
- package/README.md +3 -1
- package/dist/logger.d.ts +101 -24
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +270 -65
- package/dist/logger.js.map +1 -1
- package/dist/stringify.d.ts +15 -4
- package/dist/stringify.d.ts.map +1 -1
- package/dist/stringify.js +22 -7
- package/dist/stringify.js.map +1 -1
- package/package.json +41 -16
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Luligu
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Luligu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -55,8 +55,10 @@ import { stringify, payloadStringify, colorStringify, mqttStringify, debugString
|
|
|
55
55
|
```
|
|
56
56
|
log.debug('Debug message...', ...parameters);
|
|
57
57
|
log.info('Info message...', ...parameters);
|
|
58
|
+
log.notice('Notice message...', ...parameters);
|
|
58
59
|
log.warn('Warning message', ...parameters);
|
|
59
60
|
log.error('Error message', ...parameters);
|
|
61
|
+
log.fatal('Fatal message', ...parameters);
|
|
60
62
|
log(LogLevel.WARN, 'Warning message', ...parameters)
|
|
61
63
|
```
|
|
62
64
|
|
|
@@ -80,7 +82,7 @@ colorStringify({...})
|
|
|
80
82
|
|
|
81
83
|
# Screenshot
|
|
82
84
|
|
|
83
|
-

|
|
85
|
+

|
|
84
86
|
|
|
85
87
|
# Contributing
|
|
86
88
|
|
package/dist/logger.d.ts
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file contains the
|
|
2
|
+
* This file contains the AnsiLogger .
|
|
3
3
|
*
|
|
4
4
|
* @file logger.ts
|
|
5
5
|
* @author Luca Liguori
|
|
6
6
|
* @date 2023-06-01
|
|
7
|
-
* @version
|
|
7
|
+
* @version 2.0.0
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Copyright 2023, 2024, 2025 Luca Liguori.
|
|
10
10
|
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License.
|
|
11
22
|
*/
|
|
12
23
|
export declare const RESET = "\u001B[40;0m";
|
|
13
24
|
export declare const BRIGHT = "\u001B[1m";
|
|
@@ -33,10 +44,12 @@ export declare const CYAN = "\u001B[36m";
|
|
|
33
44
|
export declare const LIGHT_GREY = "\u001B[37m";
|
|
34
45
|
export declare const GREY = "\u001B[90m";
|
|
35
46
|
export declare const WHITE = "\u001B[97m";
|
|
36
|
-
export declare const db = "\u001B[38;5;
|
|
37
|
-
export declare const nf = "\u001B[38;5;
|
|
38
|
-
export declare const
|
|
39
|
-
export declare const
|
|
47
|
+
export declare const db = "\u001B[38;5;240m";
|
|
48
|
+
export declare const nf = "\u001B[38;5;250m";
|
|
49
|
+
export declare const nt = "\u001B[38;5;2m";
|
|
50
|
+
export declare const wr = "\u001B[38;5;3m";
|
|
51
|
+
export declare const er = "\u001B[38;5;1m";
|
|
52
|
+
export declare const ft = "\u001B[38;5;9m";
|
|
40
53
|
export declare const rs = "\u001B[40;0m";
|
|
41
54
|
export declare const rk = "\u001B[K";
|
|
42
55
|
export declare const dn = "\u001B[38;5;33m";
|
|
@@ -52,10 +65,13 @@ export declare const or = "\u001B[38;5;208m";
|
|
|
52
65
|
* LogLevel enumeration to specify the logging level.
|
|
53
66
|
*/
|
|
54
67
|
export declare const enum LogLevel {
|
|
68
|
+
NONE = "",
|
|
69
|
+
DEBUG = "debug",
|
|
55
70
|
INFO = "info",
|
|
71
|
+
NOTICE = "notice",
|
|
56
72
|
WARN = "warn",
|
|
57
73
|
ERROR = "error",
|
|
58
|
-
|
|
74
|
+
FATAL = "fatal"
|
|
59
75
|
}
|
|
60
76
|
/**
|
|
61
77
|
* Logger interface for custom loggers that can be passed to AnsiLogger for output instead of console output.
|
|
@@ -63,8 +79,10 @@ export declare const enum LogLevel {
|
|
|
63
79
|
export interface Logger {
|
|
64
80
|
debug: (...data: any[]) => void;
|
|
65
81
|
info: (...data: any[]) => void;
|
|
82
|
+
notice: (...data: any[]) => void;
|
|
66
83
|
warn: (...data: any[]) => void;
|
|
67
84
|
error: (...data: any[]) => void;
|
|
85
|
+
fatal: (...data: any[]) => void;
|
|
68
86
|
log: (level: LogLevel, message: string, ...parameters: any[]) => void;
|
|
69
87
|
}
|
|
70
88
|
/**
|
|
@@ -86,43 +104,76 @@ export interface AnsiLoggerParams {
|
|
|
86
104
|
hbLog?: Logger;
|
|
87
105
|
logName?: string;
|
|
88
106
|
logDebug?: boolean;
|
|
107
|
+
logLevel?: LogLevel;
|
|
89
108
|
logWithColors?: boolean;
|
|
90
109
|
logTimestampFormat?: TimestampFormat;
|
|
91
110
|
logCustomTimestampFormat?: string;
|
|
92
111
|
}
|
|
93
|
-
export type AnsiLoggerCallback = (
|
|
112
|
+
export type AnsiLoggerCallback = (level: string, time: string, name: string, message: string) => void;
|
|
94
113
|
/**
|
|
95
114
|
* AnsiLogger provides a customizable logging utility with ANSI color support.
|
|
96
115
|
* It allows for various configurations such as enabling debug logs, customizing log name, and more.
|
|
97
116
|
*/
|
|
98
117
|
export declare class AnsiLogger {
|
|
99
|
-
private
|
|
100
|
-
private
|
|
101
|
-
private
|
|
102
|
-
private
|
|
118
|
+
private _hbLog;
|
|
119
|
+
private _logName;
|
|
120
|
+
private _logLevel;
|
|
121
|
+
private _logWithColors;
|
|
122
|
+
private _logTimestampFormat;
|
|
123
|
+
private _logCustomTimestampFormat;
|
|
103
124
|
private logStartTime;
|
|
104
|
-
private logWithColors;
|
|
105
|
-
private logDebug;
|
|
106
|
-
private params;
|
|
107
125
|
private callback;
|
|
108
126
|
/**
|
|
109
127
|
* Constructs a new AnsiLogger instance with optional configuration parameters.
|
|
110
128
|
* @param {AnsiLoggerParams} optionalParams - Configuration options for the logger.
|
|
111
129
|
*/
|
|
112
|
-
constructor(
|
|
130
|
+
constructor(params: AnsiLoggerParams);
|
|
131
|
+
/**
|
|
132
|
+
* Gets the name of the logger.
|
|
133
|
+
* @returns {string} The logger name.
|
|
134
|
+
*/
|
|
135
|
+
get logName(): string;
|
|
136
|
+
/**
|
|
137
|
+
* Sets the log name for the logger.
|
|
138
|
+
* @param {string} name - The logger name to set.
|
|
139
|
+
*/
|
|
140
|
+
set logName(name: string);
|
|
113
141
|
/**
|
|
114
142
|
* Sets the name of the logger.
|
|
115
143
|
* @param {string} name - The new name for the logger.
|
|
144
|
+
* @deprecated Use logName getter and setter instead.
|
|
116
145
|
*/
|
|
117
146
|
setLogName(name: string): void;
|
|
118
147
|
/**
|
|
119
148
|
* Enables or disables debug logging.
|
|
120
149
|
* @param {boolean} logDebug - Flag to enable or disable debug logging.
|
|
150
|
+
* @deprecated Use logLevel getter and setter instead.
|
|
121
151
|
*/
|
|
122
152
|
setLogDebug(logDebug: boolean): void;
|
|
153
|
+
/**
|
|
154
|
+
* Gets the log level of the logger.
|
|
155
|
+
* @returns {LogLevel} The log level.
|
|
156
|
+
*/
|
|
157
|
+
get logLevel(): LogLevel;
|
|
158
|
+
/**
|
|
159
|
+
* Sets the log level for the logger.
|
|
160
|
+
* @param {LogLevel} logLevel - The log level to set.
|
|
161
|
+
*/
|
|
162
|
+
set logLevel(logLevel: LogLevel);
|
|
163
|
+
/**
|
|
164
|
+
* Gets the logWithColors flag of the logger.
|
|
165
|
+
* @returns {boolean} The logWithColors parameter.
|
|
166
|
+
*/
|
|
167
|
+
get logWithColors(): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Sets the logWithColors flag of the logger.
|
|
170
|
+
* @param {boolean} logWithColors - The logWithColors parameter to set.
|
|
171
|
+
*/
|
|
172
|
+
set logWithColors(logWithColors: boolean);
|
|
123
173
|
/**
|
|
124
174
|
* Enables or disables logging with ANSI colors.
|
|
125
175
|
* @param {boolean} logWithColors - Flag to enable or disable ANSI color logging.
|
|
176
|
+
* @deprecated Use logWithColors getter and setter instead.
|
|
126
177
|
*/
|
|
127
178
|
setlogWithColors(logWithColors: boolean): void;
|
|
128
179
|
/**
|
|
@@ -174,9 +225,21 @@ export declare class AnsiLogger {
|
|
|
174
225
|
* with this format 'yyyy-MM-dd HH:mm:ss'
|
|
175
226
|
*/
|
|
176
227
|
private formatCustomTimestamp;
|
|
228
|
+
/**
|
|
229
|
+
* Returns the current timestamp as a string.
|
|
230
|
+
*
|
|
231
|
+
* @returns {string} The current timestamp.
|
|
232
|
+
*/
|
|
233
|
+
now(): string;
|
|
234
|
+
/**
|
|
235
|
+
* Returns the timestamp based on the configured format.
|
|
236
|
+
* If the log start time is set, it returns the time passed since the start time.
|
|
237
|
+
* Otherwise, it returns the current timestamp based on the configured format.
|
|
238
|
+
* @returns {string} The timestamp string.
|
|
239
|
+
*/
|
|
177
240
|
private getTimestamp;
|
|
178
241
|
/**
|
|
179
|
-
* Logs a message with a specific level (e.g
|
|
242
|
+
* Logs a message with a specific level (e.g. debug, info, notice, warn, error, fatal) and additional parameters.
|
|
180
243
|
* This method formats the log message with ANSI colors based on the log level and other logger settings.
|
|
181
244
|
* It supports dynamic parameters for more detailed and formatted logging.
|
|
182
245
|
*
|
|
@@ -185,33 +248,47 @@ export declare class AnsiLogger {
|
|
|
185
248
|
* @param {...any[]} parameters - Additional parameters to be logged. Supports any number of parameters.
|
|
186
249
|
*/
|
|
187
250
|
log(level: LogLevel, message: string, ...parameters: any[]): void;
|
|
251
|
+
/**
|
|
252
|
+
* Logs a debug message if debug logging is enabled. This is a convenience method that delegates to the `log` method with the `LogLevel.DEBUG` level.
|
|
253
|
+
*
|
|
254
|
+
* @param {string} message - The message to log.
|
|
255
|
+
* @param {...any[]} parameters - Additional parameters to be included in the log message. Supports any number of parameters.
|
|
256
|
+
*/
|
|
257
|
+
debug(message: string, ...parameters: any[]): void;
|
|
188
258
|
/**
|
|
189
259
|
* Logs an informational message. This is a convenience method that delegates to the `log` method with the `LogLevel.INFO` level.
|
|
190
260
|
*
|
|
191
|
-
* @param {string} message - The
|
|
261
|
+
* @param {string} message - The message to log.
|
|
192
262
|
* @param {...any[]} parameters - Additional parameters to be included in the log message. Supports any number of parameters.
|
|
193
263
|
*/
|
|
194
264
|
info(message: string, ...parameters: any[]): void;
|
|
265
|
+
/**
|
|
266
|
+
* Logs a notice message. This is a convenience method that delegates to the `log` method with the `LogLevel.NOTICE` level.
|
|
267
|
+
*
|
|
268
|
+
* @param {string} message - The message to log.
|
|
269
|
+
* @param {...any[]} parameters - Additional parameters to be included in the log message. Supports any number of parameters.
|
|
270
|
+
*/
|
|
271
|
+
notice(message: string, ...parameters: any[]): void;
|
|
195
272
|
/**
|
|
196
273
|
* Logs a warning message. This is a convenience method that delegates to the `log` method with the `LogLevel.WARN` level.
|
|
197
274
|
*
|
|
198
|
-
* @param {string} message - The
|
|
275
|
+
* @param {string} message - The message to log.
|
|
199
276
|
* @param {...any[]} parameters - Additional parameters to be included in the log message. Supports any number of parameters.
|
|
200
277
|
*/
|
|
201
278
|
warn(message: string, ...parameters: any[]): void;
|
|
202
279
|
/**
|
|
203
280
|
* Logs an error message. This is a convenience method that delegates to the `log` method with the `LogLevel.ERROR` level.
|
|
204
281
|
*
|
|
205
|
-
* @param {string} message - The
|
|
282
|
+
* @param {string} message - The message to log.
|
|
206
283
|
* @param {...any[]} parameters - Additional parameters to be included in the log message. Supports any number of parameters.
|
|
207
284
|
*/
|
|
208
285
|
error(message: string, ...parameters: any[]): void;
|
|
209
286
|
/**
|
|
210
|
-
* Logs a
|
|
287
|
+
* Logs a fatal message. This is a convenience method that delegates to the `log` method with the `LogLevel.FATAL` level.
|
|
211
288
|
*
|
|
212
|
-
* @param {string} message - The
|
|
289
|
+
* @param {string} message - The message to log.
|
|
213
290
|
* @param {...any[]} parameters - Additional parameters to be included in the log message. Supports any number of parameters.
|
|
214
291
|
*/
|
|
215
|
-
|
|
292
|
+
fatal(message: string, ...parameters: any[]): void;
|
|
216
293
|
}
|
|
217
294
|
//# sourceMappingURL=logger.d.ts.map
|
package/dist/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,eAAO,MAAM,KAAK,iBAAe,CAAC;AAClC,eAAO,MAAM,MAAM,cAAY,CAAC;AAChC,eAAO,MAAM,GAAG,cAAY,CAAC;AAC7B,eAAO,MAAM,MAAM,eAAa,CAAC;AACjC,eAAO,MAAM,SAAS,cAAY,CAAC;AACnC,eAAO,MAAM,YAAY,eAAa,CAAC;AACvC,eAAO,MAAM,KAAK,cAAY,CAAC;AAC/B,eAAO,MAAM,QAAQ,eAAa,CAAC;AACnC,eAAO,MAAM,OAA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|
-
* This file contains the
|
|
2
|
+
* This file contains the AnsiLogger .
|
|
3
3
|
*
|
|
4
4
|
* @file logger.ts
|
|
5
5
|
* @author Luca Liguori
|
|
6
6
|
* @date 2023-06-01
|
|
7
|
-
* @version
|
|
7
|
+
* @version 2.0.0
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Copyright 2023, 2024, 2025 Luca Liguori.
|
|
10
10
|
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License.
|
|
11
22
|
*/
|
|
12
23
|
// ANSI color codes and styles are defined here for use in the logger
|
|
13
24
|
export const RESET = '\x1b[40;0m';
|
|
@@ -35,10 +46,12 @@ export const LIGHT_GREY = '\x1b[37m';
|
|
|
35
46
|
export const GREY = '\x1b[90m';
|
|
36
47
|
export const WHITE = '\x1b[97m';
|
|
37
48
|
// ANSI color codes short form to use in the logger
|
|
38
|
-
export const db = '\x1b[38;5;
|
|
39
|
-
export const nf = '\x1b[38;5;
|
|
40
|
-
export const
|
|
41
|
-
export const
|
|
49
|
+
export const db = '\x1b[38;5;240m'; // Debug 247
|
|
50
|
+
export const nf = '\x1b[38;5;250m'; // Info 255
|
|
51
|
+
export const nt = '\x1b[38;5;2m'; // Notice
|
|
52
|
+
export const wr = '\x1b[38;5;3m'; // Warn 220
|
|
53
|
+
export const er = '\x1b[38;5;1m'; // Error
|
|
54
|
+
export const ft = '\x1b[38;5;9m'; // Fatal
|
|
42
55
|
export const rs = '\x1b[40;0m'; // Reset colors to default foreground and background
|
|
43
56
|
export const rk = '\x1b[K'; // Erase from cursor
|
|
44
57
|
// Used internally for: homebridge-mqtt-accessories and matterbridge-mqtt-accessories
|
|
@@ -51,46 +64,92 @@ export const hk = '\x1b[38;5;79m'; // Homekit
|
|
|
51
64
|
export const pl = '\x1b[32m'; // payload
|
|
52
65
|
export const id = '\x1b[37;44m'; // id or ieee_address or UUID
|
|
53
66
|
export const or = '\x1b[38;5;208m'; // history
|
|
67
|
+
/**
|
|
68
|
+
* LogLevel enumeration to specify the logging level.
|
|
69
|
+
*/
|
|
70
|
+
export var LogLevel;
|
|
71
|
+
(function (LogLevel) {
|
|
72
|
+
LogLevel["NONE"] = "";
|
|
73
|
+
LogLevel["DEBUG"] = "debug";
|
|
74
|
+
LogLevel["INFO"] = "info";
|
|
75
|
+
LogLevel["NOTICE"] = "notice";
|
|
76
|
+
LogLevel["WARN"] = "warn";
|
|
77
|
+
LogLevel["ERROR"] = "error";
|
|
78
|
+
LogLevel["FATAL"] = "fatal";
|
|
79
|
+
})(LogLevel || (LogLevel = {}));
|
|
80
|
+
/**
|
|
81
|
+
* TimestampFormat enumeration to specify the format of timestamps in log messages.
|
|
82
|
+
*/
|
|
83
|
+
export var TimestampFormat;
|
|
84
|
+
(function (TimestampFormat) {
|
|
85
|
+
TimestampFormat[TimestampFormat["ISO"] = 0] = "ISO";
|
|
86
|
+
TimestampFormat[TimestampFormat["LOCAL_DATE"] = 1] = "LOCAL_DATE";
|
|
87
|
+
TimestampFormat[TimestampFormat["LOCAL_TIME"] = 2] = "LOCAL_TIME";
|
|
88
|
+
TimestampFormat[TimestampFormat["LOCAL_DATE_TIME"] = 3] = "LOCAL_DATE_TIME";
|
|
89
|
+
TimestampFormat[TimestampFormat["TIME_MILLIS"] = 4] = "TIME_MILLIS";
|
|
90
|
+
TimestampFormat[TimestampFormat["HOMEBRIDGE"] = 5] = "HOMEBRIDGE";
|
|
91
|
+
TimestampFormat[TimestampFormat["CUSTOM"] = 6] = "CUSTOM";
|
|
92
|
+
})(TimestampFormat || (TimestampFormat = {}));
|
|
54
93
|
// Initialize the global variable
|
|
55
|
-
globalThis.__AnsiLoggerCallback__
|
|
94
|
+
if (typeof globalThis.__AnsiLoggerCallback__ === 'undefined')
|
|
95
|
+
globalThis.__AnsiLoggerCallback__ = undefined;
|
|
96
|
+
/*
|
|
97
|
+
if (process.argv.includes('--testAnsiLoggerColors')) {
|
|
98
|
+
for (let i = 0; i < 256; i++) {
|
|
99
|
+
console.log(`\x1b[38;5;${i}mForeground color ${i.toString().padStart(3, ' ')} \x1b[1mbright\x1b[0m`);
|
|
100
|
+
}
|
|
101
|
+
console.log(`${db}Debug${rs}`);
|
|
102
|
+
console.log(`${nf}Info${rs}`);
|
|
103
|
+
console.log(`${nt}Notice${rs}`);
|
|
104
|
+
console.log(`${wr}Warn${rs}`);
|
|
105
|
+
console.log(`${er}Error${rs}`);
|
|
106
|
+
console.log(`${ft}Fatal${rs}`);
|
|
107
|
+
}
|
|
108
|
+
*/
|
|
56
109
|
/**
|
|
57
110
|
* AnsiLogger provides a customizable logging utility with ANSI color support.
|
|
58
111
|
* It allows for various configurations such as enabling debug logs, customizing log name, and more.
|
|
59
112
|
*/
|
|
60
113
|
export class AnsiLogger {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
114
|
+
_hbLog;
|
|
115
|
+
_logName;
|
|
116
|
+
_logLevel;
|
|
117
|
+
_logWithColors;
|
|
118
|
+
_logTimestampFormat;
|
|
119
|
+
_logCustomTimestampFormat;
|
|
65
120
|
logStartTime;
|
|
66
|
-
logWithColors;
|
|
67
|
-
logDebug;
|
|
68
|
-
params;
|
|
69
121
|
callback = undefined;
|
|
70
122
|
/**
|
|
71
123
|
* Constructs a new AnsiLogger instance with optional configuration parameters.
|
|
72
124
|
* @param {AnsiLoggerParams} optionalParams - Configuration options for the logger.
|
|
73
125
|
*/
|
|
74
|
-
constructor(
|
|
75
|
-
this.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
logCustomTimestampFormat: 'yyyy-MM-dd HH:mm:ss',
|
|
82
|
-
}, optionalParams);
|
|
83
|
-
this.hbLog = this.params.hbLog;
|
|
84
|
-
this.logName = this.params.logName;
|
|
85
|
-
this.logDebug = this.params.logDebug;
|
|
86
|
-
this.logWithColors = this.params.logWithColors;
|
|
87
|
-
this.logTimestampFormat = this.params.logTimestampFormat;
|
|
88
|
-
this.logCustomTimestampFormat = this.params.logCustomTimestampFormat;
|
|
126
|
+
constructor(params) {
|
|
127
|
+
this._hbLog = params.hbLog;
|
|
128
|
+
this._logName = params.logName ?? 'NodeAnsiLogger';
|
|
129
|
+
this._logLevel = params.logLevel ?? (params.logDebug === true ? "debug" /* LogLevel.DEBUG */ : "info" /* LogLevel.INFO */);
|
|
130
|
+
this._logWithColors = params.logWithColors ?? true;
|
|
131
|
+
this._logTimestampFormat = params.logTimestampFormat ?? 3 /* TimestampFormat.LOCAL_DATE_TIME */;
|
|
132
|
+
this._logCustomTimestampFormat = params.logCustomTimestampFormat ?? 'yyyy-MM-dd HH:mm:ss';
|
|
89
133
|
this.logStartTime = 0;
|
|
90
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Gets the name of the logger.
|
|
137
|
+
* @returns {string} The logger name.
|
|
138
|
+
*/
|
|
139
|
+
get logName() {
|
|
140
|
+
return this._logName;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Sets the log name for the logger.
|
|
144
|
+
* @param {string} name - The logger name to set.
|
|
145
|
+
*/
|
|
146
|
+
set logName(name) {
|
|
147
|
+
this._logName = name;
|
|
148
|
+
}
|
|
91
149
|
/**
|
|
92
150
|
* Sets the name of the logger.
|
|
93
151
|
* @param {string} name - The new name for the logger.
|
|
152
|
+
* @deprecated Use logName getter and setter instead.
|
|
94
153
|
*/
|
|
95
154
|
setLogName(name) {
|
|
96
155
|
this.logName = name;
|
|
@@ -98,30 +157,63 @@ export class AnsiLogger {
|
|
|
98
157
|
/**
|
|
99
158
|
* Enables or disables debug logging.
|
|
100
159
|
* @param {boolean} logDebug - Flag to enable or disable debug logging.
|
|
160
|
+
* @deprecated Use logLevel getter and setter instead.
|
|
101
161
|
*/
|
|
102
162
|
setLogDebug(logDebug) {
|
|
103
|
-
|
|
163
|
+
if (logDebug)
|
|
164
|
+
this.logLevel = "debug" /* LogLevel.DEBUG */;
|
|
165
|
+
else
|
|
166
|
+
this.logLevel = "info" /* LogLevel.INFO */;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Gets the log level of the logger.
|
|
170
|
+
* @returns {LogLevel} The log level.
|
|
171
|
+
*/
|
|
172
|
+
get logLevel() {
|
|
173
|
+
return this._logLevel;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Sets the log level for the logger.
|
|
177
|
+
* @param {LogLevel} logLevel - The log level to set.
|
|
178
|
+
*/
|
|
179
|
+
set logLevel(logLevel) {
|
|
180
|
+
this._logLevel = logLevel;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Gets the logWithColors flag of the logger.
|
|
184
|
+
* @returns {boolean} The logWithColors parameter.
|
|
185
|
+
*/
|
|
186
|
+
get logWithColors() {
|
|
187
|
+
return this._logWithColors;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Sets the logWithColors flag of the logger.
|
|
191
|
+
* @param {boolean} logWithColors - The logWithColors parameter to set.
|
|
192
|
+
*/
|
|
193
|
+
set logWithColors(logWithColors) {
|
|
194
|
+
this._logWithColors = logWithColors;
|
|
104
195
|
}
|
|
105
196
|
/**
|
|
106
197
|
* Enables or disables logging with ANSI colors.
|
|
107
198
|
* @param {boolean} logWithColors - Flag to enable or disable ANSI color logging.
|
|
199
|
+
* @deprecated Use logWithColors getter and setter instead.
|
|
108
200
|
*/
|
|
109
201
|
setlogWithColors(logWithColors) {
|
|
110
|
-
this.
|
|
202
|
+
this._logWithColors = logWithColors;
|
|
111
203
|
}
|
|
112
204
|
/**
|
|
113
205
|
* Sets the timestamp format for log messages.
|
|
114
206
|
* @param {TimestampFormat} format - The timestamp format to use.
|
|
115
207
|
*/
|
|
116
208
|
setLogTimestampFormat(format) {
|
|
117
|
-
this.
|
|
209
|
+
this._logTimestampFormat = format;
|
|
118
210
|
}
|
|
119
211
|
/**
|
|
120
212
|
* Sets a custom timestamp format for log messages.
|
|
121
213
|
* @param {string} format - The custom timestamp format string.
|
|
122
214
|
*/
|
|
123
215
|
setLogCustomTimestampFormat(format) {
|
|
124
|
-
this.
|
|
216
|
+
this._logCustomTimestampFormat = format;
|
|
125
217
|
}
|
|
126
218
|
/**
|
|
127
219
|
* Starts a timer with an optional message.
|
|
@@ -161,7 +253,6 @@ export class AnsiLogger {
|
|
|
161
253
|
* @param {AnsiLoggerCallback} callback - The callback function that takes three parameters: type, subtype, and message, or undefined if no callback is set.
|
|
162
254
|
*/
|
|
163
255
|
setGlobalCallback(callback) {
|
|
164
|
-
// AnsiLogger.callback = callback;
|
|
165
256
|
__AnsiLoggerCallback__ = callback;
|
|
166
257
|
}
|
|
167
258
|
/**
|
|
@@ -169,7 +260,12 @@ export class AnsiLogger {
|
|
|
169
260
|
* @returns {AnsiLoggerCallback | undefined} The callback function that takes three parameters: type, subtype, and message, or undefined if no callback is set.
|
|
170
261
|
*/
|
|
171
262
|
getGlobalCallback() {
|
|
172
|
-
|
|
263
|
+
if (__AnsiLoggerCallback__) {
|
|
264
|
+
return __AnsiLoggerCallback__;
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
return undefined;
|
|
268
|
+
}
|
|
173
269
|
}
|
|
174
270
|
/**
|
|
175
271
|
* Formats a Date object into a custom string format.
|
|
@@ -195,6 +291,20 @@ export class AnsiLogger {
|
|
|
195
291
|
.replace('mm', minutes.toString().padStart(2, '0'))
|
|
196
292
|
.replace('ss', seconds.toString().padStart(2, '0'));
|
|
197
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* Returns the current timestamp as a string.
|
|
296
|
+
*
|
|
297
|
+
* @returns {string} The current timestamp.
|
|
298
|
+
*/
|
|
299
|
+
now() {
|
|
300
|
+
return this.getTimestamp();
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Returns the timestamp based on the configured format.
|
|
304
|
+
* If the log start time is set, it returns the time passed since the start time.
|
|
305
|
+
* Otherwise, it returns the current timestamp based on the configured format.
|
|
306
|
+
* @returns {string} The timestamp string.
|
|
307
|
+
*/
|
|
198
308
|
getTimestamp() {
|
|
199
309
|
if (this.logStartTime !== 0) {
|
|
200
310
|
const timePassed = Date.now() - this.logStartTime;
|
|
@@ -202,7 +312,7 @@ export class AnsiLogger {
|
|
|
202
312
|
}
|
|
203
313
|
else {
|
|
204
314
|
let timestamp;
|
|
205
|
-
switch (this.
|
|
315
|
+
switch (this._logTimestampFormat) {
|
|
206
316
|
case 1 /* TimestampFormat.LOCAL_DATE */:
|
|
207
317
|
timestamp = new Date().toLocaleDateString();
|
|
208
318
|
break;
|
|
@@ -217,18 +327,17 @@ export class AnsiLogger {
|
|
|
217
327
|
timestamp = new Date().toISOString();
|
|
218
328
|
break;
|
|
219
329
|
case 4 /* TimestampFormat.TIME_MILLIS */:
|
|
220
|
-
// eslint-disable-next-line max-len
|
|
221
330
|
timestamp = `${new Date().getHours().toString().padStart(2, '0')}:${new Date().getMinutes().toString().padStart(2, '0')}:${new Date().getSeconds().toString().padStart(2, '0')}.${new Date().getMilliseconds().toString().padStart(3, '0')}`;
|
|
222
331
|
break;
|
|
223
332
|
case 6 /* TimestampFormat.CUSTOM */:
|
|
224
|
-
timestamp = this.formatCustomTimestamp(new Date(), this.
|
|
333
|
+
timestamp = this.formatCustomTimestamp(new Date(), this._logCustomTimestampFormat);
|
|
225
334
|
break;
|
|
226
335
|
}
|
|
227
336
|
return timestamp;
|
|
228
337
|
}
|
|
229
338
|
}
|
|
230
339
|
/**
|
|
231
|
-
* Logs a message with a specific level (e.g
|
|
340
|
+
* Logs a message with a specific level (e.g. debug, info, notice, warn, error, fatal) and additional parameters.
|
|
232
341
|
* This method formats the log message with ANSI colors based on the log level and other logger settings.
|
|
233
342
|
* It supports dynamic parameters for more detailed and formatted logging.
|
|
234
343
|
*
|
|
@@ -249,24 +358,26 @@ export class AnsiLogger {
|
|
|
249
358
|
// Convert parameters to string and append to message
|
|
250
359
|
const parametersString = parameters.length > 0 ? ' ' + parameters.join(' ') : '';
|
|
251
360
|
message += parametersString;
|
|
252
|
-
this.callback(level, this.
|
|
361
|
+
this.callback(level, this.getTimestamp(), this._logName, message);
|
|
253
362
|
}
|
|
254
|
-
else if (__AnsiLoggerCallback__ !== undefined) {
|
|
363
|
+
else if (__AnsiLoggerCallback__ && __AnsiLoggerCallback__ !== undefined) {
|
|
255
364
|
// Convert parameters to string and append to message
|
|
256
365
|
const parametersString = parameters.length > 0 ? ' ' + parameters.join(' ') : '';
|
|
257
366
|
message += parametersString;
|
|
258
|
-
__AnsiLoggerCallback__(this.
|
|
367
|
+
__AnsiLoggerCallback__(level, this.getTimestamp(), this._logName, message);
|
|
259
368
|
}
|
|
260
369
|
}
|
|
261
370
|
catch (error) {
|
|
262
371
|
// eslint-disable-next-line no-console
|
|
263
372
|
console.error('Error executing callback:', error);
|
|
264
373
|
}
|
|
265
|
-
if (this.
|
|
266
|
-
|
|
374
|
+
if (this._hbLog !== undefined) {
|
|
375
|
+
if (level !== "" /* LogLevel.NONE */) {
|
|
376
|
+
this._hbLog.log(level, message, ...parameters);
|
|
377
|
+
}
|
|
267
378
|
}
|
|
268
379
|
else {
|
|
269
|
-
if (this.
|
|
380
|
+
if (this._logWithColors) {
|
|
270
381
|
let logNameColor = ln;
|
|
271
382
|
if (typeof message !== 'string' || message.startsWith === undefined) {
|
|
272
383
|
logNameColor = ln;
|
|
@@ -289,45 +400,141 @@ export class AnsiLogger {
|
|
|
289
400
|
}
|
|
290
401
|
switch (level) {
|
|
291
402
|
case "debug" /* LogLevel.DEBUG */:
|
|
292
|
-
if (this.
|
|
403
|
+
if (this._logLevel === "debug" /* LogLevel.DEBUG */) {
|
|
293
404
|
// eslint-disable-next-line no-console
|
|
294
|
-
console.log(`${rs}${ts}[${this.getTimestamp()}] ${logNameColor}[${this.
|
|
405
|
+
console.log(`${rs}${ts}[${this.getTimestamp()}] ${logNameColor}[${this._logName}]${rs}${db}`, message, ...parameters, rs + rk);
|
|
295
406
|
}
|
|
296
407
|
break;
|
|
297
408
|
case "info" /* LogLevel.INFO */:
|
|
298
|
-
|
|
299
|
-
|
|
409
|
+
if (this._logLevel === "debug" /* LogLevel.DEBUG */ || this._logLevel === "info" /* LogLevel.INFO */) {
|
|
410
|
+
// eslint-disable-next-line no-console
|
|
411
|
+
console.log(`${rs}${ts}[${this.getTimestamp()}] ${logNameColor}[${this._logName}]${rs}${nf}`, message, ...parameters, rs + rk);
|
|
412
|
+
}
|
|
413
|
+
break;
|
|
414
|
+
case "notice" /* LogLevel.NOTICE */:
|
|
415
|
+
if (this._logLevel === "debug" /* LogLevel.DEBUG */ || this._logLevel === "info" /* LogLevel.INFO */ || this._logLevel === "notice" /* LogLevel.NOTICE */) {
|
|
416
|
+
// eslint-disable-next-line no-console
|
|
417
|
+
console.log(`${rs}${ts}[${this.getTimestamp()}] ${logNameColor}[${this._logName}]${rs}${nt}`, message, ...parameters, rs + rk);
|
|
418
|
+
}
|
|
300
419
|
break;
|
|
301
420
|
case "warn" /* LogLevel.WARN */:
|
|
302
|
-
|
|
303
|
-
|
|
421
|
+
if (this._logLevel === "debug" /* LogLevel.DEBUG */ || this._logLevel === "info" /* LogLevel.INFO */ || this._logLevel === "notice" /* LogLevel.NOTICE */ || this._logLevel === "warn" /* LogLevel.WARN */) {
|
|
422
|
+
// eslint-disable-next-line no-console
|
|
423
|
+
console.log(`${rs}${ts}[${this.getTimestamp()}] ${logNameColor}[${this._logName}]${rs}${wr}`, message, ...parameters, rs + rk);
|
|
424
|
+
}
|
|
304
425
|
break;
|
|
305
426
|
case "error" /* LogLevel.ERROR */:
|
|
306
|
-
|
|
307
|
-
|
|
427
|
+
if (this._logLevel === "debug" /* LogLevel.DEBUG */ ||
|
|
428
|
+
this._logLevel === "info" /* LogLevel.INFO */ ||
|
|
429
|
+
this._logLevel === "notice" /* LogLevel.NOTICE */ ||
|
|
430
|
+
this._logLevel === "warn" /* LogLevel.WARN */ ||
|
|
431
|
+
this._logLevel === "error" /* LogLevel.ERROR */) {
|
|
432
|
+
// eslint-disable-next-line no-console
|
|
433
|
+
console.log(`${rs}${ts}[${this.getTimestamp()}] ${logNameColor}[${this._logName}]${rs}${er}`, message, ...parameters, rs + rk);
|
|
434
|
+
}
|
|
435
|
+
break;
|
|
436
|
+
case "fatal" /* LogLevel.FATAL */:
|
|
437
|
+
if (this._logLevel === "debug" /* LogLevel.DEBUG */ ||
|
|
438
|
+
this._logLevel === "info" /* LogLevel.INFO */ ||
|
|
439
|
+
this._logLevel === "notice" /* LogLevel.NOTICE */ ||
|
|
440
|
+
this._logLevel === "warn" /* LogLevel.WARN */ ||
|
|
441
|
+
this._logLevel === "error" /* LogLevel.ERROR */ ||
|
|
442
|
+
this._logLevel === "fatal" /* LogLevel.FATAL */) {
|
|
443
|
+
// eslint-disable-next-line no-console
|
|
444
|
+
console.log(`${rs}${ts}[${this.getTimestamp()}] ${logNameColor}[${this._logName}]${rs}${ft}`, message, ...parameters, rs + rk);
|
|
445
|
+
}
|
|
446
|
+
break;
|
|
447
|
+
default:
|
|
308
448
|
break;
|
|
309
449
|
}
|
|
310
450
|
}
|
|
311
451
|
else {
|
|
312
|
-
|
|
313
|
-
|
|
452
|
+
switch (level) {
|
|
453
|
+
case "debug" /* LogLevel.DEBUG */:
|
|
454
|
+
if (this._logLevel === "debug" /* LogLevel.DEBUG */) {
|
|
455
|
+
// eslint-disable-next-line no-console
|
|
456
|
+
console.log(`${rs}[${this.getTimestamp()}] [${this._logName}] [${level}] ${message}`, ...parameters);
|
|
457
|
+
}
|
|
458
|
+
break;
|
|
459
|
+
case "info" /* LogLevel.INFO */:
|
|
460
|
+
if (this._logLevel === "debug" /* LogLevel.DEBUG */ || this._logLevel === "info" /* LogLevel.INFO */) {
|
|
461
|
+
// eslint-disable-next-line no-console
|
|
462
|
+
console.log(`${rs}[${this.getTimestamp()}] [${this._logName}] [${level}] ${message}`, ...parameters);
|
|
463
|
+
}
|
|
464
|
+
break;
|
|
465
|
+
case "notice" /* LogLevel.NOTICE */:
|
|
466
|
+
if (this._logLevel === "debug" /* LogLevel.DEBUG */ || this._logLevel === "info" /* LogLevel.INFO */ || this._logLevel === "notice" /* LogLevel.NOTICE */) {
|
|
467
|
+
// eslint-disable-next-line no-console
|
|
468
|
+
console.log(`${rs}[${this.getTimestamp()}] [${this._logName}] [${level}] ${message}`, ...parameters);
|
|
469
|
+
}
|
|
470
|
+
break;
|
|
471
|
+
case "warn" /* LogLevel.WARN */:
|
|
472
|
+
if (this._logLevel === "debug" /* LogLevel.DEBUG */ || this._logLevel === "info" /* LogLevel.INFO */ || this._logLevel === "notice" /* LogLevel.NOTICE */ || this._logLevel === "warn" /* LogLevel.WARN */) {
|
|
473
|
+
// eslint-disable-next-line no-console
|
|
474
|
+
console.log(`${rs}[${this.getTimestamp()}] [${this._logName}] [${level}] ${message}`, ...parameters);
|
|
475
|
+
}
|
|
476
|
+
break;
|
|
477
|
+
case "error" /* LogLevel.ERROR */:
|
|
478
|
+
if (this._logLevel === "debug" /* LogLevel.DEBUG */ ||
|
|
479
|
+
this._logLevel === "info" /* LogLevel.INFO */ ||
|
|
480
|
+
this._logLevel === "notice" /* LogLevel.NOTICE */ ||
|
|
481
|
+
this._logLevel === "warn" /* LogLevel.WARN */ ||
|
|
482
|
+
this._logLevel === "error" /* LogLevel.ERROR */) {
|
|
483
|
+
// eslint-disable-next-line no-console
|
|
484
|
+
console.log(`${rs}[${this.getTimestamp()}] [${this._logName}] [${level}] ${message}`, ...parameters);
|
|
485
|
+
}
|
|
486
|
+
break;
|
|
487
|
+
case "fatal" /* LogLevel.FATAL */:
|
|
488
|
+
if (this._logLevel === "debug" /* LogLevel.DEBUG */ ||
|
|
489
|
+
this._logLevel === "info" /* LogLevel.INFO */ ||
|
|
490
|
+
this._logLevel === "notice" /* LogLevel.NOTICE */ ||
|
|
491
|
+
this._logLevel === "warn" /* LogLevel.WARN */ ||
|
|
492
|
+
this._logLevel === "error" /* LogLevel.ERROR */ ||
|
|
493
|
+
this._logLevel === "fatal" /* LogLevel.FATAL */) {
|
|
494
|
+
// eslint-disable-next-line no-console
|
|
495
|
+
console.log(`${rs}[${this.getTimestamp()}] [${this._logName}] [${level}] ${message}`, ...parameters);
|
|
496
|
+
}
|
|
497
|
+
break;
|
|
498
|
+
default:
|
|
499
|
+
break;
|
|
500
|
+
}
|
|
314
501
|
}
|
|
315
502
|
}
|
|
316
503
|
}
|
|
504
|
+
/**
|
|
505
|
+
* Logs a debug message if debug logging is enabled. This is a convenience method that delegates to the `log` method with the `LogLevel.DEBUG` level.
|
|
506
|
+
*
|
|
507
|
+
* @param {string} message - The message to log.
|
|
508
|
+
* @param {...any[]} parameters - Additional parameters to be included in the log message. Supports any number of parameters.
|
|
509
|
+
*/
|
|
510
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
511
|
+
debug(message, ...parameters) {
|
|
512
|
+
this.log("debug" /* LogLevel.DEBUG */, message, ...parameters);
|
|
513
|
+
}
|
|
317
514
|
/**
|
|
318
515
|
* Logs an informational message. This is a convenience method that delegates to the `log` method with the `LogLevel.INFO` level.
|
|
319
516
|
*
|
|
320
|
-
* @param {string} message - The
|
|
517
|
+
* @param {string} message - The message to log.
|
|
321
518
|
* @param {...any[]} parameters - Additional parameters to be included in the log message. Supports any number of parameters.
|
|
322
519
|
*/
|
|
323
520
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
324
521
|
info(message, ...parameters) {
|
|
325
522
|
this.log("info" /* LogLevel.INFO */, message, ...parameters);
|
|
326
523
|
}
|
|
524
|
+
/**
|
|
525
|
+
* Logs a notice message. This is a convenience method that delegates to the `log` method with the `LogLevel.NOTICE` level.
|
|
526
|
+
*
|
|
527
|
+
* @param {string} message - The message to log.
|
|
528
|
+
* @param {...any[]} parameters - Additional parameters to be included in the log message. Supports any number of parameters.
|
|
529
|
+
*/
|
|
530
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
531
|
+
notice(message, ...parameters) {
|
|
532
|
+
this.log("notice" /* LogLevel.NOTICE */, message, ...parameters);
|
|
533
|
+
}
|
|
327
534
|
/**
|
|
328
535
|
* Logs a warning message. This is a convenience method that delegates to the `log` method with the `LogLevel.WARN` level.
|
|
329
536
|
*
|
|
330
|
-
* @param {string} message - The
|
|
537
|
+
* @param {string} message - The message to log.
|
|
331
538
|
* @param {...any[]} parameters - Additional parameters to be included in the log message. Supports any number of parameters.
|
|
332
539
|
*/
|
|
333
540
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -337,7 +544,7 @@ export class AnsiLogger {
|
|
|
337
544
|
/**
|
|
338
545
|
* Logs an error message. This is a convenience method that delegates to the `log` method with the `LogLevel.ERROR` level.
|
|
339
546
|
*
|
|
340
|
-
* @param {string} message - The
|
|
547
|
+
* @param {string} message - The message to log.
|
|
341
548
|
* @param {...any[]} parameters - Additional parameters to be included in the log message. Supports any number of parameters.
|
|
342
549
|
*/
|
|
343
550
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -345,16 +552,14 @@ export class AnsiLogger {
|
|
|
345
552
|
this.log("error" /* LogLevel.ERROR */, message, ...parameters);
|
|
346
553
|
}
|
|
347
554
|
/**
|
|
348
|
-
* Logs a
|
|
555
|
+
* Logs a fatal message. This is a convenience method that delegates to the `log` method with the `LogLevel.FATAL` level.
|
|
349
556
|
*
|
|
350
|
-
* @param {string} message - The
|
|
557
|
+
* @param {string} message - The message to log.
|
|
351
558
|
* @param {...any[]} parameters - Additional parameters to be included in the log message. Supports any number of parameters.
|
|
352
559
|
*/
|
|
353
560
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
this.log("debug" /* LogLevel.DEBUG */, message, ...parameters);
|
|
357
|
-
}
|
|
561
|
+
fatal(message, ...parameters) {
|
|
562
|
+
this.log("fatal" /* LogLevel.FATAL */, message, ...parameters);
|
|
358
563
|
}
|
|
359
564
|
}
|
|
360
565
|
/*
|
package/dist/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,qEAAqE;AACrE,MAAM,CAAC,MAAM,KAAK,GAAG,YAAY,CAAC;AAClC,MAAM,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC;AAChC,MAAM,CAAC,MAAM,GAAG,GAAG,SAAS,CAAC;AAC7B,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC;AACjC,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC;AACnC,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;AACvC,MAAM,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC;AAC/B,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC;AACnC,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AACjC,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC;AACrC,MAAM,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC;AAChC,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC;AACpC,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC;AACnC,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC;AAEtC,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC;AAChC,MAAM,CAAC,MAAM,GAAG,GAAG,UAAU,CAAC;AAC9B,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC;AAChC,MAAM,CAAC,MAAM,MAAM,GAA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,GAAG,6BAAgB,OAAO,EAAE,GAAG,UAAU,CAAC,CAAC;IAClD,CAAC;IAED;;;;;OAKG;IACH,8DAA8D;IACvD,MAAM,CAAC,OAAe,EAAE,GAAG,UAAiB;QACjD,IAAI,CAAC,GAAG,iCAAkB,OAAO,EAAE,GAAG,UAAU,CAAC,CAAC;IACpD,CAAC;IAED;;;;;OAKG;IACH,8DAA8D;IACvD,IAAI,CAAC,OAAe,EAAE,GAAG,UAAiB;QAC/C,IAAI,CAAC,GAAG,6BAAgB,OAAO,EAAE,GAAG,UAAU,CAAC,CAAC;IAClD,CAAC;IAED;;;;;OAKG;IACH,8DAA8D;IACvD,KAAK,CAAC,OAAe,EAAE,GAAG,UAAiB;QAChD,IAAI,CAAC,GAAG,+BAAiB,OAAO,EAAE,GAAG,UAAU,CAAC,CAAC;IACnD,CAAC;IAED;;;;;OAKG;IACH,8DAA8D;IACvD,KAAK,CAAC,OAAe,EAAE,GAAG,UAAiB;QAChD,IAAI,CAAC,GAAG,+BAAiB,OAAO,EAAE,GAAG,UAAU,CAAC,CAAC;IACnD,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CE"}
|
package/dist/stringify.d.ts
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file contains the functions
|
|
2
|
+
* This file contains the stringify functions.
|
|
3
3
|
*
|
|
4
|
-
* @file
|
|
4
|
+
* @file logger.ts
|
|
5
5
|
* @author Luca Liguori
|
|
6
6
|
* @date 2023-07-23
|
|
7
7
|
* @version 1.4.1
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Copyright 2023, 2024, 2025 Luca Liguori.
|
|
10
10
|
*
|
|
11
|
-
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License.
|
|
22
|
+
*/
|
|
12
23
|
export declare function payloadStringify(payload: object): string;
|
|
13
24
|
export declare function colorStringify(payload: object): string;
|
|
14
25
|
export declare function historyStringify(payload: object): string;
|
package/dist/stringify.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stringify.d.ts","sourceRoot":"","sources":["../src/stringify.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"stringify.d.ts","sourceRoot":"","sources":["../src/stringify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,wBAAgB,SAAS,CACvB,OAAO,EAAE,MAAM,EACf,YAAY,UAAQ,EACpB,YAAY,SAAM,EAClB,QAAQ,SAAM,EACd,WAAW,SAAK,EAChB,WAAW,SAAM,EACjB,YAAY,SAAM,EAClB,cAAc,SAAI,EAClB,QAAQ,SAAK,EACb,WAAW,SAAM,GAChB,MAAM,CA8CR"}
|
package/dist/stringify.js
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file contains the functions
|
|
2
|
+
* This file contains the stringify functions.
|
|
3
3
|
*
|
|
4
|
-
* @file
|
|
4
|
+
* @file logger.ts
|
|
5
5
|
* @author Luca Liguori
|
|
6
6
|
* @date 2023-07-23
|
|
7
7
|
* @version 1.4.1
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Copyright 2023, 2024, 2025 Luca Liguori.
|
|
10
10
|
*
|
|
11
|
-
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License.
|
|
22
|
+
*/
|
|
12
23
|
export function payloadStringify(payload) {
|
|
13
24
|
return stringify(payload, false, 0, 0, 0, 0, 0, 0, '"', '"');
|
|
14
25
|
}
|
|
@@ -24,7 +35,11 @@ export function mqttStringify(payload) {
|
|
|
24
35
|
export function debugStringify(payload) {
|
|
25
36
|
return stringify(payload, true, 247, 247);
|
|
26
37
|
}
|
|
27
|
-
export function stringify(payload, enableColors = false, colorPayload = 255, colorKey = 255, colorString = 35, colorNumber = 220, colorBoolean = 159, colorUndefined = 1, keyQuote = '', stringQuote = '
|
|
38
|
+
export function stringify(payload, enableColors = false, colorPayload = 255, colorKey = 255, colorString = 35, colorNumber = 220, colorBoolean = 159, colorUndefined = 1, keyQuote = '', stringQuote = "'") {
|
|
39
|
+
if (payload === null)
|
|
40
|
+
return 'null';
|
|
41
|
+
if (payload === undefined)
|
|
42
|
+
return 'undefined';
|
|
28
43
|
const clr = (color) => {
|
|
29
44
|
return enableColors ? `\x1b[38;5;${color}m` : '';
|
|
30
45
|
};
|
|
@@ -39,7 +54,7 @@ export function stringify(payload, enableColors = false, colorPayload = 255, col
|
|
|
39
54
|
}
|
|
40
55
|
let newValue = '';
|
|
41
56
|
newValue = value;
|
|
42
|
-
//console.log(typeof newValue, key, value);
|
|
57
|
+
// console.log(typeof newValue, key, value);
|
|
43
58
|
if (value === null) {
|
|
44
59
|
newValue = `${clr(colorUndefined)}null${reset()}`;
|
|
45
60
|
}
|
|
@@ -76,6 +91,6 @@ export function stringify(payload, enableColors = false, colorPayload = 255, col
|
|
|
76
91
|
string += `${clr(colorKey)}${keyQuote}${key}${keyQuote}${reset()}: ${newValue}`;
|
|
77
92
|
}
|
|
78
93
|
});
|
|
79
|
-
return string += ` ${clr(colorPayload)}` + (isArray ? ']' : '}') + `${reset()}
|
|
94
|
+
return (string += ` ${clr(colorPayload)}` + (isArray ? ']' : '}') + `${reset()}`);
|
|
80
95
|
}
|
|
81
96
|
//# sourceMappingURL=stringify.js.map
|
package/dist/stringify.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stringify.js","sourceRoot":"","sources":["../src/stringify.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"stringify.js","sourceRoot":"","sources":["../src/stringify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,OAAO,SAAS,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,OAAO,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AAC7D,CAAC;AAED,MAAM,UAAU,gBAAgB,CAA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GAAG,SAAS,CAAC,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;YACtJ,CAAC;iBAAM,CAAC;gBACN,QAAQ,GAAG,OAAO,CAAC;YACrB,CAAC;QACH,CAAC;aAAM,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACxC,QAAQ,GAAG,GAAG,GAAG,CAAC,WAAW,GAAG,CAAC,CAAC,GAAG,QAAQ,GAAG,KAAK,EAAE,EAAE,CAAC;QAC5D,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC5C,CAAC;QACD,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,IAAI,GAAG,QAAQ,EAAE,CAAC;QAC1B,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,QAAQ,GAAG,GAAG,GAAG,QAAQ,GAAG,KAAK,EAAE,KAAK,QAAQ,EAAE,CAAC;QAClF,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,MAAM,IAAI,IAAI,GAAG,CAAC,YAAY,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,KAAK,EAAE,EAAE,CAAC,CAAC;AACpF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-ansi-logger",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Enhanced Color-Coded Logging for Node.js in type script",
|
|
5
5
|
"author": "https://github.com/Luligu",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,24 +18,39 @@
|
|
|
18
18
|
},
|
|
19
19
|
"type": "module",
|
|
20
20
|
"main": "dist/index.js",
|
|
21
|
-
"types": "dist/index.d.
|
|
21
|
+
"types": "dist/index.d.ts",
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=18.0.0"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "tsc",
|
|
27
27
|
"watch": "tsc --watch",
|
|
28
|
-
"
|
|
29
|
-
"test
|
|
30
|
-
"test:
|
|
31
|
-
"
|
|
32
|
-
"
|
|
28
|
+
"testColors": "node dist/index.js --testAnsiLoggerColors",
|
|
29
|
+
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
30
|
+
"test:verbose": "node --experimental-vm-modules node_modules/jest/bin/jest.js --verbose",
|
|
31
|
+
"test:coverage": "node --experimental-vm-modules node_modules/jest/bin/jest.js --verbose --coverage",
|
|
32
|
+
"test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --verbose --watch",
|
|
33
|
+
"lint": "eslint --max-warnings=0 .",
|
|
34
|
+
"lint:fix": "eslint --fix --max-warnings=0 .",
|
|
35
|
+
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,md}\"",
|
|
36
|
+
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,css,md}\"",
|
|
33
37
|
"clean": "rimraf tsconfig.tsbuildinfo ./dist",
|
|
34
|
-
"cleanBuild": "npm run clean &&
|
|
38
|
+
"cleanBuild": "npm run clean && npm run build",
|
|
35
39
|
"deepClean": "rimraf tsconfig.tsbuildinfo package-lock.json ./dist ./node_modules",
|
|
40
|
+
"deepCleanRebuild": "npm run deepClean && npm install && npm run build && npm ls eslint rimraf inflight glob",
|
|
36
41
|
"prepublishOnly": "npm run lint && npm run cleanBuild",
|
|
37
42
|
"checkDependencies": "npx npm-check-updates",
|
|
38
|
-
"updateDependencies": "npx npm-check-updates -u"
|
|
43
|
+
"updateDependencies": "npx npm-check-updates -u && npm install & npm run cleanBuild",
|
|
44
|
+
"preversion": "npm run lint && npm run test && npm run build",
|
|
45
|
+
"postversion": "git push && git push --tags",
|
|
46
|
+
"version:patch": "npm version patch",
|
|
47
|
+
"version:minor": "npm version minor",
|
|
48
|
+
"version:major": "npm version major",
|
|
49
|
+
"install:dependencies": "npm install --save-dev rimraf",
|
|
50
|
+
"install:typescript": "npm install --save-dev @types/express @types/node @types/ws typescript && npm run build",
|
|
51
|
+
"install:eslint": "npm install --save-dev @eslint/js @types/eslint__js typescript-eslint",
|
|
52
|
+
"install:prettier": "npm install --save-dev prettier eslint-config-prettier eslint-plugin-prettier",
|
|
53
|
+
"install:jest": "npm install --save-dev jest ts-jest @types/jest eslint-plugin-jest"
|
|
39
54
|
},
|
|
40
55
|
"keywords": [
|
|
41
56
|
"node-ansi-logger",
|
|
@@ -43,14 +58,24 @@
|
|
|
43
58
|
"color",
|
|
44
59
|
"logger"
|
|
45
60
|
],
|
|
61
|
+
"overrides": {
|
|
62
|
+
"eslint": "latest"
|
|
63
|
+
},
|
|
46
64
|
"devDependencies": {
|
|
65
|
+
"@eslint/js": "^9.7.0",
|
|
66
|
+
"@types/eslint__js": "^8.42.3",
|
|
67
|
+
"@types/express": "^4.17.21",
|
|
47
68
|
"@types/jest": "^29.5.12",
|
|
48
|
-
"@types/node": "^20.
|
|
49
|
-
"@
|
|
50
|
-
"
|
|
51
|
-
"eslint": "^
|
|
69
|
+
"@types/node": "^20.14.11",
|
|
70
|
+
"@types/ws": "^8.5.11",
|
|
71
|
+
"eslint-config-prettier": "^9.1.0",
|
|
72
|
+
"eslint-plugin-jest": "^28.6.0",
|
|
73
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
52
74
|
"jest": "^29.7.0",
|
|
53
|
-
"
|
|
54
|
-
"
|
|
75
|
+
"prettier": "^3.3.3",
|
|
76
|
+
"rimraf": "^6.0.1",
|
|
77
|
+
"ts-jest": "^29.2.3",
|
|
78
|
+
"typescript": "^5.5.4",
|
|
79
|
+
"typescript-eslint": "^7.17.0"
|
|
55
80
|
}
|
|
56
|
-
}
|
|
81
|
+
}
|