@mks2508/better-logger 0.14.0-alpha.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +2 -1
- package/dist/Logger.d.ts +12 -16
- package/dist/Logger.d.ts.map +1 -1
- package/dist/ScopedLogger.d.ts +1 -9
- package/dist/chunks/{Logger-D_p3xnbq.js → Logger-C9zTFYBh.js} +2 -2
- package/dist/chunks/Logger-C9zTFYBh.js.map +1 -0
- package/dist/chunks/{Logger-Crw1woqR.js → Logger-Th9SfADL.js} +50 -17
- package/dist/chunks/Logger-Th9SfADL.js.map +1 -0
- package/dist/chunks/ScopedLogger-HgV_J-ug.js +2 -0
- package/dist/chunks/ScopedLogger-HgV_J-ug.js.map +1 -0
- package/dist/chunks/ScopedLogger-uAAeJkfA.js +361 -0
- package/dist/chunks/ScopedLogger-uAAeJkfA.js.map +1 -0
- package/dist/chunks/environment-5I5unY89.js +4 -0
- package/dist/chunks/environment-5I5unY89.js.map +1 -0
- package/dist/chunks/{environment-Bxbnw4pd.js → environment-wXLQvk5g.js} +103 -11
- package/dist/chunks/environment-wXLQvk5g.js.map +1 -0
- package/dist/chunks/formatting-CiFnwe1I.js +2 -0
- package/dist/chunks/formatting-CiFnwe1I.js.map +1 -0
- package/dist/chunks/formatting-DIhpRCCk.js +380 -0
- package/dist/chunks/formatting-DIhpRCCk.js.map +1 -0
- package/dist/cli/CommandProcessor.d.ts +1 -4
- package/dist/cli/commands/ConfigCommand.d.ts +2 -5
- package/dist/cli/commands/ExportCommand.d.ts +2 -5
- package/dist/cli/commands/HistoryCommand.d.ts +2 -5
- package/dist/cli/commands/StatusCommand.d.ts +2 -5
- package/dist/cli/commands/ThemeCommand.d.ts +2 -5
- package/dist/cli/help.d.ts +2 -5
- package/dist/cli/index.d.ts +1 -1
- package/dist/constants.d.ts +110 -5
- package/dist/constants.d.ts.map +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.ts +1 -8
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +281 -307
- package/dist/core.js.map +1 -1
- package/dist/exports-module.d.ts +1 -8
- package/dist/exports.cjs +1 -1
- package/dist/exports.js +2 -2
- package/dist/handlers/AnalyticsLogHandler.d.ts +1 -4
- package/dist/handlers/ExportLogHandler.d.ts +1 -4
- package/dist/handlers/ExportLogHandler.d.ts.map +1 -1
- package/dist/handlers/FileLogHandler.d.ts +1 -4
- package/dist/handlers/RemoteLogHandler.d.ts +1 -4
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +8 -41
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +246 -159
- package/dist/index.js.map +1 -1
- package/dist/styling/LogStyleBuilder.d.ts +2 -5
- package/dist/styling/SemanticStyles.d.ts +0 -3
- package/dist/styling/SmartPresets.d.ts +1 -4
- package/dist/styling/banners.d.ts +1 -4
- package/dist/styling/themes.d.ts +2 -5
- package/dist/styling-module.d.ts +1 -8
- package/dist/styling.cjs +1 -1
- package/dist/styling.js +3 -3
- package/dist/types/core.d.ts +13 -0
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/handlers.d.ts +1 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/ansi-colors.d.ts +156 -0
- package/dist/utils/ansi-colors.d.ts.map +1 -0
- package/dist/utils/formatting.d.ts +20 -2
- package/dist/utils/formatting.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/output.d.ts +1 -4
- package/dist/utils/stackTrace.d.ts +1 -4
- package/package.json +2 -1
- package/src/Logger.ts +102 -64
- package/src/constants.ts +131 -1
- package/src/core.ts +11 -7
- package/src/handlers/ExportLogHandler.ts +2 -1
- package/src/index.ts +62 -27
- package/src/styling/SemanticStyles.ts +1 -1
- package/src/types/core.ts +15 -1
- package/src/types/index.ts +1 -0
- package/src/utils/ansi-colors.ts +333 -0
- package/src/utils/formatting.ts +196 -6
- package/src/utils/index.ts +23 -11
- package/vite.config.ts +1 -1
- package/dist/.tsbuildinfo +0 -1
- package/dist/Logger.js +0 -1124
- package/dist/ScopedLogger.js +0 -426
- package/dist/chunks/Logger-Crw1woqR.js.map +0 -1
- package/dist/chunks/Logger-D_p3xnbq.js.map +0 -1
- package/dist/chunks/environment-Bxbnw4pd.js.map +0 -1
- package/dist/chunks/environment-Dm66zOML.js +0 -4
- package/dist/chunks/environment-Dm66zOML.js.map +0 -1
- package/dist/chunks/formatting-C0riPC5_.js +0 -95
- package/dist/chunks/formatting-C0riPC5_.js.map +0 -1
- package/dist/chunks/formatting-DNCAV66-.js +0 -2
- package/dist/chunks/formatting-DNCAV66-.js.map +0 -1
- package/dist/cli/CommandProcessor.js +0 -184
- package/dist/cli/commands/ConfigCommand.js +0 -88
- package/dist/cli/commands/ExportCommand.js +0 -243
- package/dist/cli/commands/HistoryCommand.js +0 -96
- package/dist/cli/commands/StatusCommand.js +0 -93
- package/dist/cli/commands/ThemeCommand.js +0 -79
- package/dist/cli/help.js +0 -118
- package/dist/cli/index.js +0 -46
- package/dist/constants.js +0 -159
- package/dist/example.js +0 -154
- package/dist/exports-module.js +0 -260
- package/dist/handlers/AnalyticsLogHandler.js +0 -19
- package/dist/handlers/ExportLogHandler.js +0 -516
- package/dist/handlers/FileLogHandler.js +0 -156
- package/dist/handlers/RemoteLogHandler.js +0 -37
- package/dist/handlers/index.js +0 -7
- package/dist/main.js +0 -139
- package/dist/styling/LogStyleBuilder.js +0 -289
- package/dist/styling/SemanticStyles.js +0 -339
- package/dist/styling/SmartPresets.js +0 -276
- package/dist/styling/StyleBuilder.js +0 -280
- package/dist/styling/banners.js +0 -155
- package/dist/styling/index.js +0 -9
- package/dist/styling/themes.js +0 -231
- package/dist/styling-module.js +0 -199
- package/dist/types/Logger.d.ts +0 -700
- package/dist/types/Logger.d.ts.map +0 -1
- package/dist/types/ScopedLogger.d.ts +0 -310
- package/dist/types/ScopedLogger.d.ts.map +0 -1
- package/dist/types/cli/CommandProcessor.d.ts +0 -100
- package/dist/types/cli/CommandProcessor.d.ts.map +0 -1
- package/dist/types/cli/commands/ConfigCommand.d.ts +0 -14
- package/dist/types/cli/commands/ConfigCommand.d.ts.map +0 -1
- package/dist/types/cli/commands/ExportCommand.d.ts +0 -48
- package/dist/types/cli/commands/ExportCommand.d.ts.map +0 -1
- package/dist/types/cli/commands/HistoryCommand.d.ts +0 -47
- package/dist/types/cli/commands/HistoryCommand.d.ts.map +0 -1
- package/dist/types/cli/commands/StatusCommand.d.ts +0 -30
- package/dist/types/cli/commands/StatusCommand.d.ts.map +0 -1
- package/dist/types/cli/commands/ThemeCommand.d.ts +0 -30
- package/dist/types/cli/commands/ThemeCommand.d.ts.map +0 -1
- package/dist/types/cli/help.d.ts +0 -12
- package/dist/types/cli/help.d.ts.map +0 -1
- package/dist/types/cli/index.d.ts +0 -15
- package/dist/types/cli/index.d.ts.map +0 -1
- package/dist/types/constants.d.ts +0 -119
- package/dist/types/constants.d.ts.map +0 -1
- package/dist/types/core.js +0 -28
- package/dist/types/example.d.ts +0 -18
- package/dist/types/example.d.ts.map +0 -1
- package/dist/types/exports-module.d.ts +0 -196
- package/dist/types/exports-module.d.ts.map +0 -1
- package/dist/types/handlers/AnalyticsLogHandler.d.ts +0 -8
- package/dist/types/handlers/AnalyticsLogHandler.d.ts.map +0 -1
- package/dist/types/handlers/ExportLogHandler.d.ts +0 -100
- package/dist/types/handlers/ExportLogHandler.d.ts.map +0 -1
- package/dist/types/handlers/FileLogHandler.d.ts +0 -33
- package/dist/types/handlers/FileLogHandler.d.ts.map +0 -1
- package/dist/types/handlers/RemoteLogHandler.d.ts +0 -11
- package/dist/types/handlers/RemoteLogHandler.d.ts.map +0 -1
- package/dist/types/handlers/index.d.ts +0 -8
- package/dist/types/handlers/index.d.ts.map +0 -1
- package/dist/types/handlers.js +0 -4
- package/dist/types/index.js +0 -4
- package/dist/types/main.d.ts +0 -2
- package/dist/types/main.d.ts.map +0 -1
- package/dist/types/styling/LogStyleBuilder.d.ts +0 -146
- package/dist/types/styling/LogStyleBuilder.d.ts.map +0 -1
- package/dist/types/styling/SemanticStyles.d.ts +0 -178
- package/dist/types/styling/SemanticStyles.d.ts.map +0 -1
- package/dist/types/styling/SmartPresets.d.ts +0 -22
- package/dist/types/styling/SmartPresets.d.ts.map +0 -1
- package/dist/types/styling/StyleBuilder.d.ts +0 -140
- package/dist/types/styling/StyleBuilder.d.ts.map +0 -1
- package/dist/types/styling/banners.d.ts +0 -42
- package/dist/types/styling/banners.d.ts.map +0 -1
- package/dist/types/styling/index.d.ts +0 -10
- package/dist/types/styling/index.d.ts.map +0 -1
- package/dist/types/styling/themes.d.ts +0 -7
- package/dist/types/styling/themes.d.ts.map +0 -1
- package/dist/types/styling-module.d.ts +0 -178
- package/dist/types/styling-module.d.ts.map +0 -1
- package/dist/types/types/core.d.ts +0 -221
- package/dist/types/types/core.d.ts.map +0 -1
- package/dist/types/types/handlers.d.ts +0 -85
- package/dist/types/types/handlers.d.ts.map +0 -1
- package/dist/types/types/index.d.ts +0 -7
- package/dist/types/types/index.d.ts.map +0 -1
- package/dist/types/utils/environment.d.ts +0 -47
- package/dist/types/utils/environment.d.ts.map +0 -1
- package/dist/types/utils/formatting.d.ts +0 -37
- package/dist/types/utils/formatting.d.ts.map +0 -1
- package/dist/types/utils/index.d.ts +0 -7
- package/dist/types/utils/index.d.ts.map +0 -1
- package/dist/types/utils/opentui-detection.d.ts +0 -34
- package/dist/types/utils/opentui-detection.d.ts.map +0 -1
- package/dist/types/utils/output.d.ts +0 -41
- package/dist/types/utils/output.d.ts.map +0 -1
- package/dist/types/utils/stackTrace.d.ts +0 -6
- package/dist/types/utils/stackTrace.d.ts.map +0 -1
- package/dist/types/utils/timestamps.d.ts +0 -20
- package/dist/types/utils/timestamps.d.ts.map +0 -1
- package/dist/utils/environment.js +0 -85
- package/dist/utils/formatting.js +0 -117
- package/dist/utils/index.js +0 -6
- package/dist/utils/opentui-detection.js +0 -116
- package/dist/utils/output.js +0 -150
- package/dist/utils/stackTrace.js +0 -81
- package/dist/utils/timestamps.js +0 -71
package/dist/utils/timestamps.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Timestamp utilities for Advanced Logger
|
|
3
|
-
*/
|
|
4
|
-
import { TIME_UNITS } from '../constants.js';
|
|
5
|
-
/**
|
|
6
|
-
* Formats the timestamp using modern Date API
|
|
7
|
-
*/
|
|
8
|
-
export function formatTimestamp() {
|
|
9
|
-
try {
|
|
10
|
-
// Use modern Temporal API if available, fallback to Date
|
|
11
|
-
const now = new Date();
|
|
12
|
-
return now.toISOString();
|
|
13
|
-
}
|
|
14
|
-
catch {
|
|
15
|
-
return new Date().toISOString();
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Parse relative time strings like "2h", "30m", "1d" into milliseconds
|
|
20
|
-
*/
|
|
21
|
-
export function parseRelativeTime(timeStr) {
|
|
22
|
-
const match = timeStr.match(/^(\d+)(ms|s|m|h|d)$/);
|
|
23
|
-
if (!match) {
|
|
24
|
-
throw new Error(`Invalid time format: ${timeStr}. Use format like "2h", "30m", "1d"`);
|
|
25
|
-
}
|
|
26
|
-
const [, amount, unit] = match;
|
|
27
|
-
const multiplier = TIME_UNITS[unit];
|
|
28
|
-
return parseInt(amount || '0', 10) * multiplier;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Parse time input which can be Date, ISO string, or relative time
|
|
32
|
-
*/
|
|
33
|
-
export function parseTimeInput(input) {
|
|
34
|
-
if (input instanceof Date) {
|
|
35
|
-
return input;
|
|
36
|
-
}
|
|
37
|
-
if (typeof input === 'number') {
|
|
38
|
-
// Assume hours ago
|
|
39
|
-
return new Date(Date.now() - input * TIME_UNITS.h);
|
|
40
|
-
}
|
|
41
|
-
if (typeof input === 'string') {
|
|
42
|
-
// Try parsing as ISO date first
|
|
43
|
-
const isoDate = new Date(input);
|
|
44
|
-
if (!isNaN(isoDate.getTime())) {
|
|
45
|
-
return isoDate;
|
|
46
|
-
}
|
|
47
|
-
// Try parsing as relative time
|
|
48
|
-
try {
|
|
49
|
-
const ms = parseRelativeTime(input);
|
|
50
|
-
return new Date(Date.now() - ms);
|
|
51
|
-
}
|
|
52
|
-
catch {
|
|
53
|
-
throw new Error(`Invalid time format: ${input}`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
throw new Error(`Unsupported time input type: ${typeof input}`);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Format timestamp for display in different contexts
|
|
60
|
-
*/
|
|
61
|
-
export function formatDisplayTime(date, format = 'short') {
|
|
62
|
-
switch (format) {
|
|
63
|
-
case 'time-only':
|
|
64
|
-
return date.toTimeString().slice(0, 8); // HH:MM:SS
|
|
65
|
-
case 'full':
|
|
66
|
-
return date.toISOString();
|
|
67
|
-
case 'short':
|
|
68
|
-
default:
|
|
69
|
-
return date.toISOString().slice(11, 23); // HH:MM:SS.mmm
|
|
70
|
-
}
|
|
71
|
-
}
|