@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.
Files changed (205) hide show
  1. package/.claude/settings.local.json +2 -1
  2. package/dist/Logger.d.ts +12 -16
  3. package/dist/Logger.d.ts.map +1 -1
  4. package/dist/ScopedLogger.d.ts +1 -9
  5. package/dist/chunks/{Logger-D_p3xnbq.js → Logger-C9zTFYBh.js} +2 -2
  6. package/dist/chunks/Logger-C9zTFYBh.js.map +1 -0
  7. package/dist/chunks/{Logger-Crw1woqR.js → Logger-Th9SfADL.js} +50 -17
  8. package/dist/chunks/Logger-Th9SfADL.js.map +1 -0
  9. package/dist/chunks/ScopedLogger-HgV_J-ug.js +2 -0
  10. package/dist/chunks/ScopedLogger-HgV_J-ug.js.map +1 -0
  11. package/dist/chunks/ScopedLogger-uAAeJkfA.js +361 -0
  12. package/dist/chunks/ScopedLogger-uAAeJkfA.js.map +1 -0
  13. package/dist/chunks/environment-5I5unY89.js +4 -0
  14. package/dist/chunks/environment-5I5unY89.js.map +1 -0
  15. package/dist/chunks/{environment-Bxbnw4pd.js → environment-wXLQvk5g.js} +103 -11
  16. package/dist/chunks/environment-wXLQvk5g.js.map +1 -0
  17. package/dist/chunks/formatting-CiFnwe1I.js +2 -0
  18. package/dist/chunks/formatting-CiFnwe1I.js.map +1 -0
  19. package/dist/chunks/formatting-DIhpRCCk.js +380 -0
  20. package/dist/chunks/formatting-DIhpRCCk.js.map +1 -0
  21. package/dist/cli/CommandProcessor.d.ts +1 -4
  22. package/dist/cli/commands/ConfigCommand.d.ts +2 -5
  23. package/dist/cli/commands/ExportCommand.d.ts +2 -5
  24. package/dist/cli/commands/HistoryCommand.d.ts +2 -5
  25. package/dist/cli/commands/StatusCommand.d.ts +2 -5
  26. package/dist/cli/commands/ThemeCommand.d.ts +2 -5
  27. package/dist/cli/help.d.ts +2 -5
  28. package/dist/cli/index.d.ts +1 -1
  29. package/dist/constants.d.ts +110 -5
  30. package/dist/constants.d.ts.map +1 -1
  31. package/dist/core.cjs +1 -1
  32. package/dist/core.cjs.map +1 -1
  33. package/dist/core.d.ts +1 -8
  34. package/dist/core.d.ts.map +1 -1
  35. package/dist/core.js +281 -307
  36. package/dist/core.js.map +1 -1
  37. package/dist/exports-module.d.ts +1 -8
  38. package/dist/exports.cjs +1 -1
  39. package/dist/exports.js +2 -2
  40. package/dist/handlers/AnalyticsLogHandler.d.ts +1 -4
  41. package/dist/handlers/ExportLogHandler.d.ts +1 -4
  42. package/dist/handlers/ExportLogHandler.d.ts.map +1 -1
  43. package/dist/handlers/FileLogHandler.d.ts +1 -4
  44. package/dist/handlers/RemoteLogHandler.d.ts +1 -4
  45. package/dist/index.cjs +1 -1
  46. package/dist/index.cjs.map +1 -1
  47. package/dist/index.d.ts +8 -41
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +246 -159
  50. package/dist/index.js.map +1 -1
  51. package/dist/styling/LogStyleBuilder.d.ts +2 -5
  52. package/dist/styling/SemanticStyles.d.ts +0 -3
  53. package/dist/styling/SmartPresets.d.ts +1 -4
  54. package/dist/styling/banners.d.ts +1 -4
  55. package/dist/styling/themes.d.ts +2 -5
  56. package/dist/styling-module.d.ts +1 -8
  57. package/dist/styling.cjs +1 -1
  58. package/dist/styling.js +3 -3
  59. package/dist/types/core.d.ts +13 -0
  60. package/dist/types/core.d.ts.map +1 -1
  61. package/dist/types/handlers.d.ts +1 -4
  62. package/dist/types/index.d.ts +1 -1
  63. package/dist/types/index.d.ts.map +1 -1
  64. package/dist/utils/ansi-colors.d.ts +156 -0
  65. package/dist/utils/ansi-colors.d.ts.map +1 -0
  66. package/dist/utils/formatting.d.ts +20 -2
  67. package/dist/utils/formatting.d.ts.map +1 -1
  68. package/dist/utils/index.d.ts +1 -0
  69. package/dist/utils/index.d.ts.map +1 -1
  70. package/dist/utils/output.d.ts +1 -4
  71. package/dist/utils/stackTrace.d.ts +1 -4
  72. package/package.json +2 -1
  73. package/src/Logger.ts +102 -64
  74. package/src/constants.ts +131 -1
  75. package/src/core.ts +11 -7
  76. package/src/handlers/ExportLogHandler.ts +2 -1
  77. package/src/index.ts +62 -27
  78. package/src/styling/SemanticStyles.ts +1 -1
  79. package/src/types/core.ts +15 -1
  80. package/src/types/index.ts +1 -0
  81. package/src/utils/ansi-colors.ts +333 -0
  82. package/src/utils/formatting.ts +196 -6
  83. package/src/utils/index.ts +23 -11
  84. package/vite.config.ts +1 -1
  85. package/dist/.tsbuildinfo +0 -1
  86. package/dist/Logger.js +0 -1124
  87. package/dist/ScopedLogger.js +0 -426
  88. package/dist/chunks/Logger-Crw1woqR.js.map +0 -1
  89. package/dist/chunks/Logger-D_p3xnbq.js.map +0 -1
  90. package/dist/chunks/environment-Bxbnw4pd.js.map +0 -1
  91. package/dist/chunks/environment-Dm66zOML.js +0 -4
  92. package/dist/chunks/environment-Dm66zOML.js.map +0 -1
  93. package/dist/chunks/formatting-C0riPC5_.js +0 -95
  94. package/dist/chunks/formatting-C0riPC5_.js.map +0 -1
  95. package/dist/chunks/formatting-DNCAV66-.js +0 -2
  96. package/dist/chunks/formatting-DNCAV66-.js.map +0 -1
  97. package/dist/cli/CommandProcessor.js +0 -184
  98. package/dist/cli/commands/ConfigCommand.js +0 -88
  99. package/dist/cli/commands/ExportCommand.js +0 -243
  100. package/dist/cli/commands/HistoryCommand.js +0 -96
  101. package/dist/cli/commands/StatusCommand.js +0 -93
  102. package/dist/cli/commands/ThemeCommand.js +0 -79
  103. package/dist/cli/help.js +0 -118
  104. package/dist/cli/index.js +0 -46
  105. package/dist/constants.js +0 -159
  106. package/dist/example.js +0 -154
  107. package/dist/exports-module.js +0 -260
  108. package/dist/handlers/AnalyticsLogHandler.js +0 -19
  109. package/dist/handlers/ExportLogHandler.js +0 -516
  110. package/dist/handlers/FileLogHandler.js +0 -156
  111. package/dist/handlers/RemoteLogHandler.js +0 -37
  112. package/dist/handlers/index.js +0 -7
  113. package/dist/main.js +0 -139
  114. package/dist/styling/LogStyleBuilder.js +0 -289
  115. package/dist/styling/SemanticStyles.js +0 -339
  116. package/dist/styling/SmartPresets.js +0 -276
  117. package/dist/styling/StyleBuilder.js +0 -280
  118. package/dist/styling/banners.js +0 -155
  119. package/dist/styling/index.js +0 -9
  120. package/dist/styling/themes.js +0 -231
  121. package/dist/styling-module.js +0 -199
  122. package/dist/types/Logger.d.ts +0 -700
  123. package/dist/types/Logger.d.ts.map +0 -1
  124. package/dist/types/ScopedLogger.d.ts +0 -310
  125. package/dist/types/ScopedLogger.d.ts.map +0 -1
  126. package/dist/types/cli/CommandProcessor.d.ts +0 -100
  127. package/dist/types/cli/CommandProcessor.d.ts.map +0 -1
  128. package/dist/types/cli/commands/ConfigCommand.d.ts +0 -14
  129. package/dist/types/cli/commands/ConfigCommand.d.ts.map +0 -1
  130. package/dist/types/cli/commands/ExportCommand.d.ts +0 -48
  131. package/dist/types/cli/commands/ExportCommand.d.ts.map +0 -1
  132. package/dist/types/cli/commands/HistoryCommand.d.ts +0 -47
  133. package/dist/types/cli/commands/HistoryCommand.d.ts.map +0 -1
  134. package/dist/types/cli/commands/StatusCommand.d.ts +0 -30
  135. package/dist/types/cli/commands/StatusCommand.d.ts.map +0 -1
  136. package/dist/types/cli/commands/ThemeCommand.d.ts +0 -30
  137. package/dist/types/cli/commands/ThemeCommand.d.ts.map +0 -1
  138. package/dist/types/cli/help.d.ts +0 -12
  139. package/dist/types/cli/help.d.ts.map +0 -1
  140. package/dist/types/cli/index.d.ts +0 -15
  141. package/dist/types/cli/index.d.ts.map +0 -1
  142. package/dist/types/constants.d.ts +0 -119
  143. package/dist/types/constants.d.ts.map +0 -1
  144. package/dist/types/core.js +0 -28
  145. package/dist/types/example.d.ts +0 -18
  146. package/dist/types/example.d.ts.map +0 -1
  147. package/dist/types/exports-module.d.ts +0 -196
  148. package/dist/types/exports-module.d.ts.map +0 -1
  149. package/dist/types/handlers/AnalyticsLogHandler.d.ts +0 -8
  150. package/dist/types/handlers/AnalyticsLogHandler.d.ts.map +0 -1
  151. package/dist/types/handlers/ExportLogHandler.d.ts +0 -100
  152. package/dist/types/handlers/ExportLogHandler.d.ts.map +0 -1
  153. package/dist/types/handlers/FileLogHandler.d.ts +0 -33
  154. package/dist/types/handlers/FileLogHandler.d.ts.map +0 -1
  155. package/dist/types/handlers/RemoteLogHandler.d.ts +0 -11
  156. package/dist/types/handlers/RemoteLogHandler.d.ts.map +0 -1
  157. package/dist/types/handlers/index.d.ts +0 -8
  158. package/dist/types/handlers/index.d.ts.map +0 -1
  159. package/dist/types/handlers.js +0 -4
  160. package/dist/types/index.js +0 -4
  161. package/dist/types/main.d.ts +0 -2
  162. package/dist/types/main.d.ts.map +0 -1
  163. package/dist/types/styling/LogStyleBuilder.d.ts +0 -146
  164. package/dist/types/styling/LogStyleBuilder.d.ts.map +0 -1
  165. package/dist/types/styling/SemanticStyles.d.ts +0 -178
  166. package/dist/types/styling/SemanticStyles.d.ts.map +0 -1
  167. package/dist/types/styling/SmartPresets.d.ts +0 -22
  168. package/dist/types/styling/SmartPresets.d.ts.map +0 -1
  169. package/dist/types/styling/StyleBuilder.d.ts +0 -140
  170. package/dist/types/styling/StyleBuilder.d.ts.map +0 -1
  171. package/dist/types/styling/banners.d.ts +0 -42
  172. package/dist/types/styling/banners.d.ts.map +0 -1
  173. package/dist/types/styling/index.d.ts +0 -10
  174. package/dist/types/styling/index.d.ts.map +0 -1
  175. package/dist/types/styling/themes.d.ts +0 -7
  176. package/dist/types/styling/themes.d.ts.map +0 -1
  177. package/dist/types/styling-module.d.ts +0 -178
  178. package/dist/types/styling-module.d.ts.map +0 -1
  179. package/dist/types/types/core.d.ts +0 -221
  180. package/dist/types/types/core.d.ts.map +0 -1
  181. package/dist/types/types/handlers.d.ts +0 -85
  182. package/dist/types/types/handlers.d.ts.map +0 -1
  183. package/dist/types/types/index.d.ts +0 -7
  184. package/dist/types/types/index.d.ts.map +0 -1
  185. package/dist/types/utils/environment.d.ts +0 -47
  186. package/dist/types/utils/environment.d.ts.map +0 -1
  187. package/dist/types/utils/formatting.d.ts +0 -37
  188. package/dist/types/utils/formatting.d.ts.map +0 -1
  189. package/dist/types/utils/index.d.ts +0 -7
  190. package/dist/types/utils/index.d.ts.map +0 -1
  191. package/dist/types/utils/opentui-detection.d.ts +0 -34
  192. package/dist/types/utils/opentui-detection.d.ts.map +0 -1
  193. package/dist/types/utils/output.d.ts +0 -41
  194. package/dist/types/utils/output.d.ts.map +0 -1
  195. package/dist/types/utils/stackTrace.d.ts +0 -6
  196. package/dist/types/utils/stackTrace.d.ts.map +0 -1
  197. package/dist/types/utils/timestamps.d.ts +0 -20
  198. package/dist/types/utils/timestamps.d.ts.map +0 -1
  199. package/dist/utils/environment.js +0 -85
  200. package/dist/utils/formatting.js +0 -117
  201. package/dist/utils/index.js +0 -6
  202. package/dist/utils/opentui-detection.js +0 -116
  203. package/dist/utils/output.js +0 -150
  204. package/dist/utils/stackTrace.js +0 -81
  205. package/dist/utils/timestamps.js +0 -71
@@ -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
- }