node-ansi-logger 3.3.2-dev-20261022-1fdc86a → 3.3.2-dev-20261101-706d6a5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -4
- package/dist/logger.d.ts +14 -4
- package/dist/logger.js +31 -9
- package/npm-shrinkwrap.json +3 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -25,6 +25,7 @@ If you like this project and find it useful, please consider giving it a star on
|
|
|
25
25
|
|
|
26
26
|
### Added
|
|
27
27
|
|
|
28
|
+
- [logger]: Add `AnsiLogger.isLogLevel()` and `AnsiLogger.isTimestampFormat()` static type guard helpers.
|
|
28
29
|
- [logger]: Add an opt-in global circular message cache with configurable capacity, snapshots, callback replay, clearing and static setter/getter.
|
|
29
30
|
- [devcontainer]: Add [`Dev Container`](.devcontainer/README.md) v.2.2.0 with dual Node and Bun runtime support.
|
|
30
31
|
- [agents]: Add a [`shared setup`](.agents/README.md) for all agents: OpenAI Codex, Claude Code, GitHub Copilot and Google Gemini / Antigravity.
|
|
@@ -32,18 +33,33 @@ If you like this project and find it useful, please consider giving it a star on
|
|
|
32
33
|
|
|
33
34
|
### Changed
|
|
34
35
|
|
|
35
|
-
- [
|
|
36
|
+
- [logger]: BREAKING: Remove the deprecated `logDebug` constructor option. Use `logLevel` instead.
|
|
37
|
+
- [vscode]: Update `.vscode/settings.json` to v.1.0.17.
|
|
36
38
|
- [config]: Update Oxlint and Oxfmt configurations to v.1.1.0 and Antigravity settings to v.1.0.5.
|
|
37
39
|
- [config]: Update TypeScript build configurations and rename `vite.config.ts` to `vitest.config.ts`, including CI workflow detection.
|
|
38
40
|
- [styleguide]: Update [`STYLEGUIDE.md`](STYLEGUIDE.md) to v.1.1.0: align it with the lint and format config and add the Commit Messages and Changelog sections.
|
|
39
41
|
- [scripts]: Update scripts to v.2.0.0.
|
|
40
42
|
- [package]: Upgrade package.
|
|
41
|
-
- [package]: Bump `oxfmt` to v.0.
|
|
42
|
-
- [package]: Bump `oxlint` to v.1.
|
|
43
|
+
- [package]: Bump `oxfmt` to v.0.75.0.
|
|
44
|
+
- [package]: Bump `oxlint` to v.1.90.0.
|
|
43
45
|
- [package]: Bump `oxlint-tsgolint` to v.7.0.2004.
|
|
44
46
|
- [package]: Bump `vitest` to v.5.0.5.
|
|
45
47
|
- [package]: Bump `@vitest/coverage-v8` to v.5.0.5.
|
|
46
|
-
- [package]: Bump `@types/node` to v.26.6.
|
|
48
|
+
- [package]: Bump `@types/node` to v.26.6.6.
|
|
49
|
+
- [codex]: Update `.codex/config.toml` to v.1.0.6.
|
|
50
|
+
- [agents]: Update `.github/commit-message-instructions.md` to v.1.0.1.
|
|
51
|
+
- [vscode]: Update `.vscode/tasks.json`.
|
|
52
|
+
- [agents]: Update `AGENTS.md` to v.1.0.8.
|
|
53
|
+
- [config]: Update `CODE_OF_CONDUCT.md` to v.1.0.0.
|
|
54
|
+
- [config]: Update `CONTRIBUTING.md` to v.1.0.1.
|
|
55
|
+
- [scripts]: Update `scripts/downloads.mjs`.
|
|
56
|
+
- [scripts]: Update `scripts/git-sync-dev.mjs`.
|
|
57
|
+
- [config]: Update `src/logger.ts`.
|
|
58
|
+
- [config]: Update `vitest/cache.test.ts`.
|
|
59
|
+
- [config]: Update `vitest/logger.branchcoverage.test.ts`.
|
|
60
|
+
- [config]: Update `vitest/logger.test.ts`.
|
|
61
|
+
- [config]: Add `SHARED-AGENTS.md`.
|
|
62
|
+
- [config]: Add `TOOLCHAIN.md` v.1.0.1.
|
|
47
63
|
|
|
48
64
|
### Fixed
|
|
49
65
|
|
package/dist/logger.d.ts
CHANGED
|
@@ -106,10 +106,6 @@ export interface AnsiLoggerParams {
|
|
|
106
106
|
extLog?: Logger;
|
|
107
107
|
logName?: string;
|
|
108
108
|
logNameColor?: string;
|
|
109
|
-
/**
|
|
110
|
-
* @deprecated Use logLevel instead.
|
|
111
|
-
*/
|
|
112
|
-
logDebug?: boolean;
|
|
113
109
|
logLevel?: LogLevel;
|
|
114
110
|
logWithColors?: boolean;
|
|
115
111
|
logTimestampFormat?: TimestampFormat;
|
|
@@ -165,6 +161,20 @@ export declare class AnsiLogger {
|
|
|
165
161
|
* AnsiLogger.create({ logName: 'MyLogger' }).info('This is a info message');
|
|
166
162
|
*/
|
|
167
163
|
static create(params: AnsiLoggerParams): AnsiLogger;
|
|
164
|
+
/**
|
|
165
|
+
* Checks whether a value is a valid LogLevel.
|
|
166
|
+
*
|
|
167
|
+
* @param {unknown} value - The value to check.
|
|
168
|
+
* @returns {value is LogLevel} True if the value is one of the LogLevel values.
|
|
169
|
+
*/
|
|
170
|
+
static isLogLevel(value: unknown): value is LogLevel;
|
|
171
|
+
/**
|
|
172
|
+
* Checks whether a value is a valid TimestampFormat.
|
|
173
|
+
*
|
|
174
|
+
* @param {unknown} value - The value to check.
|
|
175
|
+
* @returns {value is TimestampFormat} True if the value is one of the TimestampFormat values.
|
|
176
|
+
*/
|
|
177
|
+
static isTimestampFormat(value: unknown): value is TimestampFormat;
|
|
168
178
|
/**
|
|
169
179
|
* Gets the name of the logger.
|
|
170
180
|
*
|
package/dist/logger.js
CHANGED
|
@@ -150,16 +150,10 @@ export class AnsiLogger {
|
|
|
150
150
|
this.#extLog = params.extLog;
|
|
151
151
|
this.#logName = params.logName ?? 'NodeAnsiLogger';
|
|
152
152
|
this.#logNameColor = params.logNameColor ?? '[38;5;31m';
|
|
153
|
-
|
|
154
|
-
this.#logLevel = params.logLevel ?? (params.logDebug === true ? "debug" /* LogLevel.DEBUG */ : "info" /* LogLevel.INFO */);
|
|
153
|
+
this.#logLevel = params.logLevel ?? "info" /* LogLevel.INFO */;
|
|
155
154
|
this.#logWithColors = params.logWithColors ?? process.env.NO_COLOR !== '1';
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
params.logTimestampFormat !== undefined
|
|
159
|
-
? params.logTimestampFormat
|
|
160
|
-
: process.env.NODE_ANSI_LOGGER_TIMESTAMP_FORMAT !== undefined && ['0', '1', '2', '3', '4', '5', '6'].includes(process.env.NODE_ANSI_LOGGER_TIMESTAMP_FORMAT)
|
|
161
|
-
? Number(process.env.NODE_ANSI_LOGGER_TIMESTAMP_FORMAT)
|
|
162
|
-
: 3 /* TimestampFormat.LOCAL_DATE_TIME */;
|
|
155
|
+
const envTimestampFormat = /^\d$/.test(process.env.NODE_ANSI_LOGGER_TIMESTAMP_FORMAT ?? '') ? Number(process.env.NODE_ANSI_LOGGER_TIMESTAMP_FORMAT) : undefined;
|
|
156
|
+
this.#logTimestampFormat = params.logTimestampFormat ?? (AnsiLogger.isTimestampFormat(envTimestampFormat) ? envTimestampFormat : 3 /* TimestampFormat.LOCAL_DATE_TIME */);
|
|
163
157
|
this.#logTimeStampColor = params.logTimeStampColor ?? '[38;5;245m';
|
|
164
158
|
this.#logCustomTimestampFormat =
|
|
165
159
|
params.logCustomTimestampFormat !== undefined && typeof params.logCustomTimestampFormat === 'string'
|
|
@@ -182,6 +176,34 @@ export class AnsiLogger {
|
|
|
182
176
|
static create(params) {
|
|
183
177
|
return new AnsiLogger(params);
|
|
184
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Checks whether a value is a valid LogLevel.
|
|
181
|
+
*
|
|
182
|
+
* @param {unknown} value - The value to check.
|
|
183
|
+
* @returns {value is LogLevel} True if the value is one of the LogLevel values.
|
|
184
|
+
*/
|
|
185
|
+
static isLogLevel(value) {
|
|
186
|
+
const levels = ["debug" /* LogLevel.DEBUG */, "info" /* LogLevel.INFO */, "notice" /* LogLevel.NOTICE */, "warn" /* LogLevel.WARN */, "error" /* LogLevel.ERROR */, "fatal" /* LogLevel.FATAL */, "" /* LogLevel.NONE */];
|
|
187
|
+
return typeof value === 'string' && levels.includes(value);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Checks whether a value is a valid TimestampFormat.
|
|
191
|
+
*
|
|
192
|
+
* @param {unknown} value - The value to check.
|
|
193
|
+
* @returns {value is TimestampFormat} True if the value is one of the TimestampFormat values.
|
|
194
|
+
*/
|
|
195
|
+
static isTimestampFormat(value) {
|
|
196
|
+
const formats = [
|
|
197
|
+
0 /* TimestampFormat.ISO */,
|
|
198
|
+
1 /* TimestampFormat.LOCAL_DATE */,
|
|
199
|
+
2 /* TimestampFormat.LOCAL_TIME */,
|
|
200
|
+
3 /* TimestampFormat.LOCAL_DATE_TIME */,
|
|
201
|
+
4 /* TimestampFormat.TIME_MILLIS */,
|
|
202
|
+
5 /* TimestampFormat.HOMEBRIDGE */,
|
|
203
|
+
6 /* TimestampFormat.CUSTOM */,
|
|
204
|
+
];
|
|
205
|
+
return typeof value === 'number' && formats.includes(value);
|
|
206
|
+
}
|
|
185
207
|
/**
|
|
186
208
|
* Gets the name of the logger.
|
|
187
209
|
*
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-ansi-logger",
|
|
3
|
-
"version": "3.3.2-dev-
|
|
3
|
+
"version": "3.3.2-dev-20261101-706d6a5",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "node-ansi-logger",
|
|
9
|
-
"version": "3.3.2-dev-
|
|
9
|
+
"version": "3.3.2-dev-20261101-706d6a5",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"engines": {
|
|
12
|
-
"node": ">=
|
|
12
|
+
"node": ">=22.13.0 <23.0.0 || >=24.0.0 <25.0.0 || >=26.0.0 <27.0.0"
|
|
13
13
|
},
|
|
14
14
|
"funding": {
|
|
15
15
|
"type": "buymeacoffee",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-ansi-logger",
|
|
3
|
-
"version": "3.3.2-dev-
|
|
3
|
+
"version": "3.3.2-dev-20261101-706d6a5",
|
|
4
4
|
"description": "Enhanced Ansi Color Logging and Stringify for Node.js in type script",
|
|
5
5
|
"author": "https://github.com/Luligu",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
|
-
"node": ">=
|
|
39
|
+
"node": ">=22.13.0 <23.0.0 || >=24.0.0 <25.0.0 || >=26.0.0 <27.0.0"
|
|
40
40
|
},
|
|
41
41
|
"files": [
|
|
42
42
|
"dist",
|