@mks2508/better-logger 0.0.2-alpha.2 → 0.3.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 (326) hide show
  1. package/.claude/settings.local.json +18 -2
  2. package/.github/workflows/ci-quality.yml +357 -0
  3. package/.github/workflows/docs-demo.yml +119 -0
  4. package/.github/workflows/releases-core.yml +512 -0
  5. package/.github/workflows/releases-full.yml +582 -0
  6. package/.github/{workflows → workflows-backup}/ci.yml +12 -110
  7. package/.github/workflows-backup/nightly.yml +196 -0
  8. package/.github/workflows-backup/release-optimized.yml +373 -0
  9. package/.release-notes-0.2.0.md +129 -0
  10. package/.yamllint +28 -0
  11. package/CHANGELOG.json +783 -0
  12. package/CLAUDE.md +92 -1
  13. package/README.md +198 -490
  14. package/bun.lock +323 -0
  15. package/demo.html +9 -2
  16. package/dist/.tsbuildinfo +1 -0
  17. package/dist/Logger.d.ts +272 -0
  18. package/dist/Logger.d.ts.map +1 -0
  19. package/dist/Logger.js +680 -0
  20. package/dist/ScopedLogger.d.ts +126 -0
  21. package/dist/ScopedLogger.d.ts.map +1 -0
  22. package/dist/ScopedLogger.js +234 -0
  23. package/dist/chunks/Logger-BpeuYIxR.js +2 -0
  24. package/dist/chunks/Logger-BpeuYIxR.js.map +1 -0
  25. package/dist/chunks/Logger-Didxtr23.js +3275 -0
  26. package/dist/chunks/Logger-Didxtr23.js.map +1 -0
  27. package/dist/chunks/RemoteLogHandler-CjWpWZGl.js +33 -0
  28. package/dist/chunks/RemoteLogHandler-CjWpWZGl.js.map +1 -0
  29. package/dist/chunks/RemoteLogHandler-ymkQ97xl.js +2 -0
  30. package/dist/chunks/RemoteLogHandler-ymkQ97xl.js.map +1 -0
  31. package/dist/chunks/environment-Bxbnw4pd.js +544 -0
  32. package/dist/chunks/environment-Bxbnw4pd.js.map +1 -0
  33. package/dist/chunks/environment-Dm66zOML.js +4 -0
  34. package/dist/chunks/environment-Dm66zOML.js.map +1 -0
  35. package/dist/chunks/formatting-C0riPC5_.js +95 -0
  36. package/dist/chunks/formatting-C0riPC5_.js.map +1 -0
  37. package/dist/chunks/formatting-DNCAV66-.js +2 -0
  38. package/dist/chunks/formatting-DNCAV66-.js.map +1 -0
  39. package/dist/cli/CommandProcessor.d.ts +103 -0
  40. package/dist/cli/CommandProcessor.d.ts.map +1 -0
  41. package/dist/cli/CommandProcessor.js +184 -0
  42. package/dist/cli/commands/ConfigCommand.d.ts +17 -0
  43. package/dist/cli/commands/ConfigCommand.d.ts.map +1 -0
  44. package/dist/cli/commands/ConfigCommand.js +88 -0
  45. package/dist/cli/commands/ExportCommand.d.ts +51 -0
  46. package/dist/cli/commands/ExportCommand.d.ts.map +1 -0
  47. package/dist/cli/commands/ExportCommand.js +243 -0
  48. package/dist/cli/commands/HistoryCommand.d.ts +50 -0
  49. package/dist/cli/commands/HistoryCommand.d.ts.map +1 -0
  50. package/dist/cli/commands/HistoryCommand.js +96 -0
  51. package/dist/cli/commands/StatusCommand.d.ts +33 -0
  52. package/dist/cli/commands/StatusCommand.d.ts.map +1 -0
  53. package/dist/cli/commands/StatusCommand.js +93 -0
  54. package/dist/cli/commands/ThemeCommand.d.ts +33 -0
  55. package/dist/cli/commands/ThemeCommand.d.ts.map +1 -0
  56. package/dist/cli/commands/ThemeCommand.js +79 -0
  57. package/dist/cli/help.d.ts +15 -0
  58. package/dist/cli/help.d.ts.map +1 -0
  59. package/dist/cli/help.js +118 -0
  60. package/dist/cli/index.d.ts +15 -0
  61. package/dist/cli/index.d.ts.map +1 -0
  62. package/dist/cli/index.js +46 -0
  63. package/dist/constants.d.ts +122 -0
  64. package/dist/constants.d.ts.map +1 -0
  65. package/dist/constants.js +159 -0
  66. package/dist/core.cjs +1 -1
  67. package/dist/core.cjs.map +1 -1
  68. package/dist/core.d.ts +134 -0
  69. package/dist/core.d.ts.map +1 -0
  70. package/dist/core.js +315 -242
  71. package/dist/core.js.map +1 -1
  72. package/dist/example.d.ts +18 -0
  73. package/dist/example.d.ts.map +1 -0
  74. package/dist/example.js +154 -0
  75. package/dist/exports-module.d.ts +203 -0
  76. package/dist/exports-module.d.ts.map +1 -0
  77. package/dist/exports-module.js +260 -0
  78. package/dist/exports.cjs +1 -1
  79. package/dist/exports.cjs.map +1 -1
  80. package/dist/exports.js +5 -4
  81. package/dist/exports.js.map +1 -1
  82. package/dist/handlers/AnalyticsLogHandler.d.ts +11 -0
  83. package/dist/handlers/AnalyticsLogHandler.d.ts.map +1 -0
  84. package/dist/handlers/AnalyticsLogHandler.js +19 -0
  85. package/dist/handlers/ExportLogHandler.d.ts +103 -0
  86. package/dist/handlers/ExportLogHandler.d.ts.map +1 -0
  87. package/dist/handlers/ExportLogHandler.js +516 -0
  88. package/dist/handlers/FileLogHandler.d.ts +36 -0
  89. package/dist/handlers/FileLogHandler.d.ts.map +1 -0
  90. package/dist/handlers/FileLogHandler.js +156 -0
  91. package/dist/handlers/RemoteLogHandler.d.ts +14 -0
  92. package/dist/handlers/RemoteLogHandler.d.ts.map +1 -0
  93. package/dist/handlers/RemoteLogHandler.js +37 -0
  94. package/dist/handlers/index.d.ts +8 -0
  95. package/dist/handlers/index.d.ts.map +1 -0
  96. package/dist/handlers/index.js +7 -0
  97. package/dist/index.cjs +1 -1
  98. package/dist/index.cjs.map +1 -1
  99. package/dist/index.d.ts +86 -0
  100. package/dist/index.d.ts.map +1 -0
  101. package/dist/index.js +89 -103
  102. package/dist/index.js.map +1 -1
  103. package/dist/main.d.ts +2 -0
  104. package/dist/main.d.ts.map +1 -0
  105. package/dist/main.js +139 -0
  106. package/dist/styling/LogStyleBuilder.d.ts +149 -0
  107. package/dist/styling/LogStyleBuilder.d.ts.map +1 -0
  108. package/dist/styling/LogStyleBuilder.js +289 -0
  109. package/dist/styling/SemanticStyles.d.ts +181 -0
  110. package/dist/styling/SemanticStyles.d.ts.map +1 -0
  111. package/dist/styling/SemanticStyles.js +339 -0
  112. package/dist/styling/SmartPresets.d.ts +25 -0
  113. package/dist/styling/SmartPresets.d.ts.map +1 -0
  114. package/dist/styling/SmartPresets.js +276 -0
  115. package/dist/styling/StyleBuilder.d.ts +140 -0
  116. package/dist/styling/StyleBuilder.d.ts.map +1 -0
  117. package/dist/styling/StyleBuilder.js +280 -0
  118. package/dist/styling/banners.d.ts +45 -0
  119. package/dist/styling/banners.d.ts.map +1 -0
  120. package/dist/styling/banners.js +155 -0
  121. package/dist/styling/index.d.ts +10 -0
  122. package/dist/styling/index.d.ts.map +1 -0
  123. package/dist/styling/index.js +9 -0
  124. package/dist/styling/themes.d.ts +10 -0
  125. package/dist/styling/themes.d.ts.map +1 -0
  126. package/dist/styling/themes.js +231 -0
  127. package/dist/styling-module.d.ts +185 -0
  128. package/dist/styling-module.d.ts.map +1 -0
  129. package/dist/styling-module.js +199 -0
  130. package/dist/styling.cjs +1 -1
  131. package/dist/styling.cjs.map +1 -1
  132. package/dist/styling.js +6 -6
  133. package/dist/styling.js.map +1 -1
  134. package/dist/types/Logger.d.ts +268 -0
  135. package/dist/types/Logger.d.ts.map +1 -0
  136. package/dist/types/ScopedLogger.d.ts +123 -0
  137. package/dist/types/ScopedLogger.d.ts.map +1 -0
  138. package/dist/types/cli/CommandProcessor.d.ts +100 -0
  139. package/dist/types/cli/CommandProcessor.d.ts.map +1 -0
  140. package/dist/types/cli/commands/ConfigCommand.d.ts +14 -0
  141. package/dist/types/cli/commands/ConfigCommand.d.ts.map +1 -0
  142. package/dist/types/cli/commands/ExportCommand.d.ts +48 -0
  143. package/dist/types/cli/commands/ExportCommand.d.ts.map +1 -0
  144. package/dist/types/cli/commands/HistoryCommand.d.ts +47 -0
  145. package/dist/types/cli/commands/HistoryCommand.d.ts.map +1 -0
  146. package/dist/types/cli/commands/StatusCommand.d.ts +30 -0
  147. package/dist/types/cli/commands/StatusCommand.d.ts.map +1 -0
  148. package/dist/types/cli/commands/ThemeCommand.d.ts +30 -0
  149. package/dist/types/cli/commands/ThemeCommand.d.ts.map +1 -0
  150. package/dist/types/cli/help.d.ts +12 -0
  151. package/dist/types/cli/help.d.ts.map +1 -0
  152. package/dist/types/cli/index.d.ts +15 -0
  153. package/dist/types/cli/index.d.ts.map +1 -0
  154. package/dist/types/constants.d.ts +119 -0
  155. package/dist/types/constants.d.ts.map +1 -0
  156. package/dist/types/core.d.ts +125 -211
  157. package/dist/types/core.d.ts.map +1 -0
  158. package/dist/types/core.js +13 -0
  159. package/dist/types/example.d.ts +18 -0
  160. package/dist/types/example.d.ts.map +1 -0
  161. package/dist/types/exports-module.d.ts +196 -0
  162. package/dist/types/exports-module.d.ts.map +1 -0
  163. package/dist/types/handlers/AnalyticsLogHandler.d.ts +8 -0
  164. package/dist/types/handlers/AnalyticsLogHandler.d.ts.map +1 -0
  165. package/dist/types/handlers/ExportLogHandler.d.ts +100 -0
  166. package/dist/types/handlers/ExportLogHandler.d.ts.map +1 -0
  167. package/dist/types/handlers/FileLogHandler.d.ts +33 -0
  168. package/dist/types/handlers/FileLogHandler.d.ts.map +1 -0
  169. package/dist/types/handlers/RemoteLogHandler.d.ts +11 -0
  170. package/dist/types/handlers/RemoteLogHandler.d.ts.map +1 -0
  171. package/dist/types/handlers/index.d.ts +8 -0
  172. package/dist/types/handlers/index.d.ts.map +1 -0
  173. package/dist/types/handlers.d.ts +88 -0
  174. package/dist/types/handlers.d.ts.map +1 -0
  175. package/dist/types/handlers.js +4 -0
  176. package/dist/types/index.d.ts +7 -675
  177. package/dist/types/index.d.ts.map +1 -0
  178. package/dist/types/index.js +4 -0
  179. package/dist/types/main.d.ts +2 -0
  180. package/dist/types/main.d.ts.map +1 -0
  181. package/dist/types/styling/LogStyleBuilder.d.ts +146 -0
  182. package/dist/types/styling/LogStyleBuilder.d.ts.map +1 -0
  183. package/dist/types/styling/SemanticStyles.d.ts +178 -0
  184. package/dist/types/styling/SemanticStyles.d.ts.map +1 -0
  185. package/dist/types/styling/SmartPresets.d.ts +22 -0
  186. package/dist/types/styling/SmartPresets.d.ts.map +1 -0
  187. package/dist/types/styling/StyleBuilder.d.ts +140 -0
  188. package/dist/types/styling/StyleBuilder.d.ts.map +1 -0
  189. package/dist/types/styling/banners.d.ts +42 -0
  190. package/dist/types/styling/banners.d.ts.map +1 -0
  191. package/dist/types/styling/index.d.ts +10 -0
  192. package/dist/types/styling/index.d.ts.map +1 -0
  193. package/dist/types/styling/themes.d.ts +7 -0
  194. package/dist/types/styling/themes.d.ts.map +1 -0
  195. package/dist/types/styling-module.d.ts +178 -0
  196. package/dist/types/styling-module.d.ts.map +1 -0
  197. package/dist/types/types/core.d.ts +125 -0
  198. package/dist/types/types/core.d.ts.map +1 -0
  199. package/dist/types/types/handlers.d.ts +85 -0
  200. package/dist/types/types/handlers.d.ts.map +1 -0
  201. package/dist/types/types/index.d.ts +7 -0
  202. package/dist/types/types/index.d.ts.map +1 -0
  203. package/dist/types/utils/environment.d.ts +47 -0
  204. package/dist/types/utils/environment.d.ts.map +1 -0
  205. package/dist/types/utils/formatting.d.ts +37 -0
  206. package/dist/types/utils/formatting.d.ts.map +1 -0
  207. package/dist/types/utils/index.d.ts +7 -0
  208. package/dist/types/utils/index.d.ts.map +1 -0
  209. package/dist/types/utils/opentui-detection.d.ts +34 -0
  210. package/dist/types/utils/opentui-detection.d.ts.map +1 -0
  211. package/dist/types/utils/output.d.ts +41 -0
  212. package/dist/types/utils/output.d.ts.map +1 -0
  213. package/dist/types/utils/stackTrace.d.ts +6 -0
  214. package/dist/types/utils/stackTrace.d.ts.map +1 -0
  215. package/dist/types/utils/timestamps.d.ts +20 -0
  216. package/dist/types/utils/timestamps.d.ts.map +1 -0
  217. package/dist/utils/environment.d.ts +47 -0
  218. package/dist/utils/environment.d.ts.map +1 -0
  219. package/dist/utils/environment.js +85 -0
  220. package/dist/utils/formatting.d.ts +40 -0
  221. package/dist/utils/formatting.d.ts.map +1 -0
  222. package/dist/utils/formatting.js +117 -0
  223. package/dist/utils/index.d.ts +7 -0
  224. package/dist/utils/index.d.ts.map +1 -0
  225. package/dist/utils/index.js +6 -0
  226. package/dist/utils/opentui-detection.d.ts +34 -0
  227. package/dist/utils/opentui-detection.d.ts.map +1 -0
  228. package/dist/utils/opentui-detection.js +116 -0
  229. package/dist/utils/output.d.ts +44 -0
  230. package/dist/utils/output.d.ts.map +1 -0
  231. package/dist/utils/output.js +150 -0
  232. package/dist/utils/stackTrace.d.ts +9 -0
  233. package/dist/utils/stackTrace.d.ts.map +1 -0
  234. package/dist/utils/stackTrace.js +81 -0
  235. package/dist/utils/timestamps.d.ts +20 -0
  236. package/dist/utils/timestamps.d.ts.map +1 -0
  237. package/dist/utils/timestamps.js +71 -0
  238. package/docs/API.md +691 -0
  239. package/docs/CORE.md +10 -10
  240. package/docs/DEVELOPMENT.md +731 -0
  241. package/docs/PACKAGES.md +244 -0
  242. package/docs/_config.yml +36 -0
  243. package/docs/index.md +179 -0
  244. package/examples/README.md +208 -0
  245. package/examples/basic-logging.js +75 -0
  246. package/examples/data-export.js +234 -0
  247. package/examples/package.json +16 -0
  248. package/examples/performance-timing.js +170 -0
  249. package/examples/simplified-api.js +124 -0
  250. package/examples/styling-themes.js +207 -0
  251. package/package.json +37 -21
  252. package/packages/core/package.json +57 -0
  253. package/packages/exports/package.json +41 -0
  254. package/packages/nodejs-opentui/README.md +232 -0
  255. package/packages/nodejs-opentui/package.json +72 -0
  256. package/packages/nodejs-opentui/src/LogRenderer.ts +171 -0
  257. package/packages/nodejs-opentui/src/OpenTUILogHandler.ts +178 -0
  258. package/packages/nodejs-opentui/src/components/LogBadge.tsx +131 -0
  259. package/packages/nodejs-opentui/src/index.ts +133 -0
  260. package/packages/nodejs-opentui/src/types.ts +158 -0
  261. package/packages/nodejs-opentui/tsconfig.json +20 -0
  262. package/packages/styling/package.json +41 -0
  263. package/project-utils/README.md +172 -0
  264. package/project-utils/auto-release-gemini.ts +1193 -0
  265. package/project-utils/auto-release-ui.ts +1329 -0
  266. package/project-utils/commit-generator.ts +1385 -0
  267. package/project-utils/commit-ui.ts +264 -0
  268. package/project-utils/git-utils.ts +199 -0
  269. package/project-utils/github-release-manager.ts +466 -0
  270. package/project-utils/project-config.ts +260 -0
  271. package/project-utils/prompt-templates.js +345 -0
  272. package/project-utils/prompt-templates.ts +422 -0
  273. package/project-utils/version-manager.ts +1078 -0
  274. package/src/Logger.ts +251 -16
  275. package/src/ScopedLogger.ts +262 -0
  276. package/src/cli/CommandProcessor.ts +173 -2
  277. package/src/cli/commands/HistoryCommand.ts +117 -0
  278. package/src/cli/index.ts +12 -0
  279. package/src/constants.ts +84 -2
  280. package/src/core.ts +119 -46
  281. package/src/example.ts +4 -4
  282. package/src/exports-module.ts +1 -1
  283. package/src/handlers/ExportLogHandler.ts +141 -0
  284. package/src/handlers/FileLogHandler.ts +144 -5
  285. package/src/index.ts +1 -1
  286. package/src/main.ts +3 -3
  287. package/src/styling/LogStyleBuilder.ts +355 -0
  288. package/src/styling/SemanticStyles.ts +380 -0
  289. package/src/styling/SmartPresets.ts +288 -0
  290. package/src/styling/StyleBuilder.ts +14 -0
  291. package/src/styling/index.ts +16 -1
  292. package/src/styling-module.ts +1 -1
  293. package/src/types/core.ts +60 -0
  294. package/src/types/index.ts +6 -0
  295. package/src/utils/environment.ts +94 -0
  296. package/src/utils/formatting.ts +142 -0
  297. package/src/utils/index.ts +3 -0
  298. package/src/utils/opentui-detection.ts +138 -0
  299. package/src/utils/output.ts +66 -8
  300. package/test-core-browser.html +237 -0
  301. package/test-core-node.js +63 -0
  302. package/tests/test-conflict-resolution.ts +391 -0
  303. package/tests/validate-workflows.sh +131 -0
  304. package/tests/yaml-autofix.sh +146 -0
  305. package/vite.config.ts +189 -50
  306. package/.npmrc.bak +0 -1
  307. package/dist/chunks/Logger-BQhMKy_T.js +0 -2
  308. package/dist/chunks/Logger-BQhMKy_T.js.map +0 -1
  309. package/dist/chunks/Logger-BrFKFZcD.js +0 -978
  310. package/dist/chunks/Logger-BrFKFZcD.js.map +0 -1
  311. package/dist/chunks/core-2opW4Pi3.js +0 -194
  312. package/dist/chunks/core-2opW4Pi3.js.map +0 -1
  313. package/dist/chunks/core-DyugwSYZ.js +0 -4
  314. package/dist/chunks/core-DyugwSYZ.js.map +0 -1
  315. package/dist/chunks/exports-BNP3R7dp.js +0 -421
  316. package/dist/chunks/exports-BNP3R7dp.js.map +0 -1
  317. package/dist/chunks/exports-U1xLBXrY.js +0 -2
  318. package/dist/chunks/exports-U1xLBXrY.js.map +0 -1
  319. package/dist/chunks/styling-DhUDzwlE.js +0 -654
  320. package/dist/chunks/styling-DhUDzwlE.js.map +0 -1
  321. package/dist/chunks/styling-tmRDI28D.js +0 -2
  322. package/dist/chunks/styling-tmRDI28D.js.map +0 -1
  323. package/dist/types/exports.d.ts +0 -600
  324. package/dist/types/styling.d.ts +0 -751
  325. package/src/Logger.ts.backup +0 -1684
  326. /package/.github/{workflows → workflows-backup}/release.yml +0 -0
@@ -0,0 +1,79 @@
1
+ /**
2
+ * @fileoverview Theme and banner commands for Advanced Logger CLI
3
+ */
4
+ import { THEME_PRESETS, BANNER_VARIANTS } from '../../styling/index.js';
5
+ import { StyleBuilder } from '../../styling/index.js';
6
+ /**
7
+ * Themes command - show available themes
8
+ */
9
+ export class ThemesCommand {
10
+ name = 'themes';
11
+ description = 'Show available theme presets';
12
+ usage = '/themes';
13
+ execute(_args, logger) {
14
+ logger.group('🎨 Available Themes');
15
+ Object.keys(THEME_PRESETS).forEach(themeName => {
16
+ const preview = THEME_PRESETS[themeName];
17
+ const previewStyle = new StyleBuilder()
18
+ .bg(preview.info.background)
19
+ .color(preview.info.color)
20
+ .padding('4px 8px')
21
+ .rounded('4px')
22
+ .border(preview.info.border)
23
+ .build();
24
+ console.log(`%c${themeName}`, previewStyle, `- ${themeName} theme preview`);
25
+ });
26
+ logger.groupEnd();
27
+ }
28
+ }
29
+ /**
30
+ * Banners command - show available banner types
31
+ */
32
+ export class BannersCommand {
33
+ name = 'banners';
34
+ description = 'Show available banner types';
35
+ usage = '/banners';
36
+ execute(_args, logger) {
37
+ logger.group('🖼️ Available Banner Types');
38
+ Object.keys(BANNER_VARIANTS).forEach(bannerName => {
39
+ const banner = BANNER_VARIANTS[bannerName];
40
+ console.log(`%c${bannerName}`, 'font-weight: bold; color: #667eea;');
41
+ console.log(`%cPreview:`, 'color: #666; font-size: 12px;');
42
+ // Show a mini preview
43
+ if (bannerName === 'simple') {
44
+ console.log(`%c${banner.text}`, banner.style);
45
+ }
46
+ else if (bannerName === 'ascii') {
47
+ console.log(`%c${banner.text.split('\n').slice(1, 4).join('\n')}...`, 'font-family: monospace; color: #667eea; font-size: 10px;');
48
+ }
49
+ else if (bannerName === 'unicode') {
50
+ console.log(`%c${banner.text}`, banner.style);
51
+ }
52
+ else {
53
+ console.log(`%c${bannerName} banner`, 'color: #666; font-style: italic;');
54
+ }
55
+ });
56
+ logger.groupEnd();
57
+ }
58
+ }
59
+ /**
60
+ * Banner command - change/show banner type
61
+ */
62
+ export class BannerCommand {
63
+ name = 'banner';
64
+ description = 'Change or show current banner type';
65
+ usage = '/banner [type]';
66
+ execute(args, logger) {
67
+ if (!args) {
68
+ logger.showBanner();
69
+ return;
70
+ }
71
+ if (args in BANNER_VARIANTS) {
72
+ logger.setBannerType(args);
73
+ logger.showBanner();
74
+ }
75
+ else {
76
+ logger.error(`Invalid banner type: ${args}. Available: ${Object.keys(BANNER_VARIANTS).join(', ')}`);
77
+ }
78
+ }
79
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @fileoverview Help system for Advanced Logger CLI
3
+ */
4
+ import type { ICommand } from './CommandProcessor.js';
5
+ import type { Logger } from '../Logger.js';
6
+ /**
7
+ * Help command - show comprehensive CLI help
8
+ */
9
+ export declare class HelpCommand implements ICommand {
10
+ name: string;
11
+ description: string;
12
+ usage: string;
13
+ execute(_args: string, logger: Logger): void;
14
+ }
15
+ //# sourceMappingURL=help.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C;;GAEG;AACH,qBAAa,WAAY,YAAW,QAAQ;IACxC,IAAI,SAAU;IACd,WAAW,SAA0C;IACrD,KAAK,SAAqB;IAE1B,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;CA8G/C"}
@@ -0,0 +1,118 @@
1
+ /**
2
+ * @fileoverview Help system for Advanced Logger CLI
3
+ */
4
+ import { StyleBuilder } from '../styling/index.js';
5
+ /**
6
+ * Help command - show comprehensive CLI help
7
+ */
8
+ export class HelpCommand {
9
+ name = 'help';
10
+ description = 'Show CLI help and available commands';
11
+ usage = '/help [command]';
12
+ execute(_args, logger) {
13
+ const helpStyle = new StyleBuilder()
14
+ .bg('linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%)')
15
+ .color('#495057')
16
+ .padding('15px 20px')
17
+ .rounded('8px')
18
+ .border('1px solid #dee2e6')
19
+ .font('Monaco, Consolas, monospace')
20
+ .size('13px')
21
+ .build();
22
+ const helpText = `
23
+ ╭─────────────── ADVANCED LOGGER CLI COMMANDS ─────────────────╮
24
+ │ │
25
+ │ CONFIGURATION │
26
+ │ /config Show current configuration │
27
+ │ /config {json} Apply JSON configuration │
28
+ │ /config key=val Apply key-value configuration │
29
+ │ /themes Show available themes │
30
+ │ /banners Show available banner types │
31
+ │ /banner [type] Change/show banner type │
32
+ │ /status Show logger status & buffer stats │
33
+ │ /demo Show feature demonstration │
34
+ │ /reset Reset to default configuration │
35
+ │ │
36
+ │ EXPORT & CLIPBOARD │
37
+ │ /export <format> Export logs (json|csv|md|plain|html) │
38
+ │ /copy <format> Copy logs to clipboard │
39
+ │ /buffer-size N Set log buffer size │
40
+ │ /buffer-info Show buffer statistics │
41
+ │ /clear-buffer Clear stored logs │
42
+ │ │
43
+ │ EXPORT FILTERS (for export/copy commands) │
44
+ │ --level error,warn Filter by log levels │
45
+ │ --since 2h Logs from last 2 hours │
46
+ │ --until 1h Logs until 1 hour ago │
47
+ │ --prefix API,DB Filter by prefixes │
48
+ │ --exclude-prefix INT Exclude prefixes │
49
+ │ --last 50 Last 50 logs only │
50
+ │ --first 25 First 25 logs only │
51
+ │ --search "error" Search in log messages │
52
+ │ --with-stack Only logs with stack traces │
53
+ │ --errors-only Only error + critical logs │
54
+ │ --group-by level Group by level/prefix/hour │
55
+ │ │
56
+ │ EXPORT OPTIONS │
57
+ │ --minimal Minimal output format │
58
+ │ --compact Remove extra whitespace │
59
+ │ --styled Include styling (HTML format) │
60
+ │ │
61
+ ├──────────────────── CONFIGURATION OPTIONS ─────────────────┤
62
+ │ │
63
+ │ theme: default | dark | light | neon | minimal | cyberpunk│
64
+ │ bannerType: simple | ascii | unicode | svg | animated │
65
+ │ verbosity: debug | info | warn | error | critical | silent│
66
+ │ enableColors: true | false │
67
+ │ enableTimestamps: true | false │
68
+ │ enableStackTrace: true | false │
69
+ │ globalPrefix: "string" │
70
+ │ bufferSize: number (50-10000) │
71
+ │ │
72
+ ├──────────────────────── EXAMPLES ──────────────────────────┤
73
+ │ │
74
+ │ Basic Configuration: │
75
+ │ /config {"theme":"dark","verbosity":"debug"} │
76
+ │ /config theme=neon,bufferSize=2000 │
77
+ │ /banner animated Change to animated banner │
78
+ │ │
79
+ │ Export Examples: │
80
+ │ /export json --level=error,warn --last=25 │
81
+ │ /export csv --since=2h --prefix=API │
82
+ │ /export markdown --group-by=level --errors-only │
83
+ │ /export html --styled --since=1h │
84
+ │ │
85
+ │ Clipboard Examples: │
86
+ │ /copy plain --minimal --last=10 │
87
+ │ /copy json --search="authentication" --compact │
88
+ │ /copy csv --since=30m --exclude-prefix=DEBUG │
89
+ │ │
90
+ │ Buffer Management: │
91
+ │ /buffer-size 5000 Increase buffer to 5000 logs │
92
+ │ /buffer-info Show detailed buffer statistics │
93
+ │ /clear-buffer Clear all stored logs │
94
+ │ │
95
+ │ Time Formats: │
96
+ │ --since=2h 2 hours ago │
97
+ │ --since=30m 30 minutes ago │
98
+ │ --since=1d 1 day ago │
99
+ │ --since="2024-01-01T10:00:00Z" Specific ISO date │
100
+ │ │
101
+ ╰─────────────────────────────────────────────────────────────╯`;
102
+ console.log(`%c${helpText}`, helpStyle);
103
+ // Show quick tips
104
+ logger.group('💡 Quick Tips');
105
+ const tips = [
106
+ 'Use /demo to see all logger features in action',
107
+ 'Logs are automatically stored in a circular buffer for export',
108
+ 'Export formats: JSON (structured), CSV (Excel), Markdown (readable), Plain (simple), HTML (styled)',
109
+ 'Time filters support relative (2h, 30m) and absolute (ISO) formats',
110
+ 'Combine multiple filters: /export json --level=error --since=1h --search="auth"',
111
+ 'Use /copy for quick clipboard access instead of /export'
112
+ ];
113
+ tips.forEach(tip => {
114
+ logger.info(`• ${tip}`);
115
+ });
116
+ logger.groupEnd();
117
+ }
118
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @fileoverview CLI system exports for Advanced Logger
3
+ */
4
+ export { CommandProcessor, type ICommand } from './CommandProcessor.js';
5
+ import { CommandProcessor } from './CommandProcessor.js';
6
+ export { ConfigCommand } from './commands/ConfigCommand.js';
7
+ export { ThemesCommand, BannersCommand, BannerCommand } from './commands/ThemeCommand.js';
8
+ export { StatusCommand, ResetCommand, DemoCommand } from './commands/StatusCommand.js';
9
+ export { ExportCommand, CopyCommand, BufferSizeCommand, ClearBufferCommand, BufferInfoCommand } from './commands/ExportCommand.js';
10
+ export { HelpCommand } from './help.js';
11
+ /**
12
+ * Create and configure default CLI processor
13
+ */
14
+ export declare function createDefaultCLI(): CommandProcessor;
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,gBAAgB,EAAE,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,EACH,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACpB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAqBxC;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,gBAAgB,CAyBnD"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @fileoverview CLI system exports for Advanced Logger
3
+ */
4
+ // Core CLI system
5
+ export { CommandProcessor } from './CommandProcessor.js';
6
+ import { CommandProcessor } from './CommandProcessor.js';
7
+ // Commands
8
+ export { ConfigCommand } from './commands/ConfigCommand.js';
9
+ export { ThemesCommand, BannersCommand, BannerCommand } from './commands/ThemeCommand.js';
10
+ export { StatusCommand, ResetCommand, DemoCommand } from './commands/StatusCommand.js';
11
+ export { ExportCommand, CopyCommand, BufferSizeCommand, ClearBufferCommand, BufferInfoCommand } from './commands/ExportCommand.js';
12
+ // Help system
13
+ export { HelpCommand } from './help.js';
14
+ // Import all commands
15
+ import { HelpCommand } from './help.js';
16
+ import { ConfigCommand } from './commands/ConfigCommand.js';
17
+ import { ThemesCommand, BannersCommand, BannerCommand } from './commands/ThemeCommand.js';
18
+ import { StatusCommand, ResetCommand, DemoCommand } from './commands/StatusCommand.js';
19
+ import { ExportCommand, CopyCommand, BufferSizeCommand, ClearBufferCommand, BufferInfoCommand } from './commands/ExportCommand.js';
20
+ import { HistoryCommand, ClearHistoryCommand, InteractiveCommand, PluginsCommand } from './commands/HistoryCommand.js';
21
+ /**
22
+ * Create and configure default CLI processor
23
+ */
24
+ export function createDefaultCLI() {
25
+ const processor = new CommandProcessor();
26
+ // Register all default commands
27
+ processor.registerCommand(new HelpCommand());
28
+ processor.registerCommand(new ConfigCommand());
29
+ processor.registerCommand(new ThemesCommand());
30
+ processor.registerCommand(new BannersCommand());
31
+ processor.registerCommand(new BannerCommand());
32
+ processor.registerCommand(new StatusCommand());
33
+ processor.registerCommand(new ResetCommand());
34
+ processor.registerCommand(new DemoCommand());
35
+ processor.registerCommand(new ExportCommand());
36
+ processor.registerCommand(new CopyCommand());
37
+ processor.registerCommand(new BufferSizeCommand());
38
+ processor.registerCommand(new ClearBufferCommand());
39
+ processor.registerCommand(new BufferInfoCommand());
40
+ // Register new enhanced commands
41
+ processor.registerCommand(new HistoryCommand());
42
+ processor.registerCommand(new ClearHistoryCommand());
43
+ processor.registerCommand(new InteractiveCommand());
44
+ processor.registerCommand(new PluginsCommand());
45
+ return processor;
46
+ }
@@ -0,0 +1,122 @@
1
+ /**
2
+ * @fileoverview Global constants for Advanced Logger
3
+ */
4
+ import type { LogLevel } from './types/index.js';
5
+ import type { LevelStyleConfig } from './utils/index.js';
6
+ /**
7
+ * Default configuration values
8
+ */
9
+ export declare const DEFAULT_CONFIG: {
10
+ readonly verbosity: "info";
11
+ readonly enableColors: true;
12
+ readonly enableTimestamps: true;
13
+ readonly enableStackTrace: true;
14
+ readonly theme: "default";
15
+ readonly bannerType: "simple";
16
+ readonly bufferSize: 1000;
17
+ readonly autoDetectTheme: true;
18
+ };
19
+ /**
20
+ * Basic level styles for core module (minimal CSS styling)
21
+ */
22
+ export declare const LEVEL_STYLES: Record<LogLevel | 'success', LevelStyleConfig>;
23
+ /**
24
+ * Maximum allowed buffer sizes for performance
25
+ */
26
+ export declare const BUFFER_LIMITS: {
27
+ readonly MIN_SIZE: 50;
28
+ readonly DEFAULT_SIZE: 1000;
29
+ readonly MAX_SIZE: 10000;
30
+ };
31
+ /**
32
+ * Export format definitions with extensions
33
+ */
34
+ export declare const EXPORT_FORMATS: {
35
+ readonly json: {
36
+ readonly extension: ".json";
37
+ readonly mimeType: "application/json";
38
+ };
39
+ readonly csv: {
40
+ readonly extension: ".csv";
41
+ readonly mimeType: "text/csv";
42
+ };
43
+ readonly markdown: {
44
+ readonly extension: ".md";
45
+ readonly mimeType: "text/markdown";
46
+ };
47
+ readonly plain: {
48
+ readonly extension: ".txt";
49
+ readonly mimeType: "text/plain";
50
+ };
51
+ readonly html: {
52
+ readonly extension: ".html";
53
+ readonly mimeType: "text/html";
54
+ };
55
+ };
56
+ /**
57
+ * CLI command definitions
58
+ */
59
+ export declare const CLI_COMMANDS: {
60
+ readonly config: "config";
61
+ readonly help: "help";
62
+ readonly themes: "themes";
63
+ readonly banners: "banners";
64
+ readonly banner: "banner";
65
+ readonly status: "status";
66
+ readonly reset: "reset";
67
+ readonly demo: "demo";
68
+ readonly export: "export";
69
+ readonly copy: "copy";
70
+ readonly 'buffer-size': "buffer-size";
71
+ readonly 'clear-buffer': "clear-buffer";
72
+ readonly 'buffer-info': "buffer-info";
73
+ };
74
+ /**
75
+ * Time parsing constants for relative time filters
76
+ */
77
+ export declare const TIME_UNITS: {
78
+ readonly ms: 1;
79
+ readonly s: 1000;
80
+ readonly m: number;
81
+ readonly h: number;
82
+ readonly d: number;
83
+ };
84
+ /**
85
+ * Default styling values
86
+ */
87
+ export declare const STYLE_DEFAULTS: {
88
+ readonly FONT_FAMILY: "Monaco, Consolas, monospace";
89
+ readonly FONT_SIZE: "12px";
90
+ readonly BORDER_RADIUS: "4px";
91
+ readonly PADDING: "4px 8px";
92
+ };
93
+ /**
94
+ * Level priority mapping for filtering
95
+ */
96
+ export declare const LEVEL_PRIORITIES: Record<LogLevel, number>;
97
+ /**
98
+ * Adaptive color configurations for DevTools theme compatibility
99
+ */
100
+ export declare const ADAPTIVE_COLORS: {
101
+ readonly timestamp: {
102
+ readonly light: "#666666";
103
+ readonly dark: "#a0a0a0";
104
+ };
105
+ readonly messageText: {
106
+ readonly light: "#2d3748";
107
+ readonly dark: "#f7fafc";
108
+ };
109
+ readonly prefix: {
110
+ readonly light: "#2d3748";
111
+ readonly dark: "#e2e8f0";
112
+ };
113
+ readonly prefixBackground: {
114
+ readonly light: "#2d3748";
115
+ readonly dark: "#4a5568";
116
+ };
117
+ readonly location: {
118
+ readonly light: "#718096";
119
+ readonly dark: "#a0aec0";
120
+ };
121
+ };
122
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAkB,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;CASjB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,QAAQ,GAAG,SAAS,EAAE,gBAAgB,CAiD9D,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;CAMjB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;CAcf,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;CAMb,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;CAKjB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAM5C,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;CAqBuB,CAAC"}
@@ -0,0 +1,159 @@
1
+ /**
2
+ * @fileoverview Global constants for Advanced Logger
3
+ */
4
+ /**
5
+ * Default configuration values
6
+ */
7
+ export const DEFAULT_CONFIG = {
8
+ verbosity: 'info',
9
+ enableColors: true,
10
+ enableTimestamps: true,
11
+ enableStackTrace: true,
12
+ theme: 'default',
13
+ bannerType: 'simple',
14
+ bufferSize: 1000,
15
+ autoDetectTheme: true,
16
+ };
17
+ /**
18
+ * Basic level styles for core module (minimal CSS styling)
19
+ */
20
+ export const LEVEL_STYLES = {
21
+ debug: {
22
+ emoji: '🔍',
23
+ label: 'DEBUG',
24
+ background: 'linear-gradient(90deg, #6c757d, #495057)',
25
+ color: '#ffffff',
26
+ border: '1px solid #6c757d',
27
+ shadow: '0 2px 4px rgba(108, 117, 125, 0.3)'
28
+ },
29
+ info: {
30
+ emoji: 'ℹ️',
31
+ label: 'INFO',
32
+ background: 'linear-gradient(90deg, #007bff, #0056b3)',
33
+ color: '#ffffff',
34
+ border: '1px solid #007bff',
35
+ shadow: '0 2px 4px rgba(0, 123, 255, 0.3)'
36
+ },
37
+ warn: {
38
+ emoji: '⚠️',
39
+ label: 'WARN',
40
+ background: 'linear-gradient(90deg, #ffc107, #e0a800)',
41
+ color: '#000000',
42
+ border: '1px solid #ffc107',
43
+ shadow: '0 2px 4px rgba(255, 193, 7, 0.3)'
44
+ },
45
+ error: {
46
+ emoji: '❌',
47
+ label: 'ERROR',
48
+ background: 'linear-gradient(90deg, #dc3545, #c82333)',
49
+ color: '#ffffff',
50
+ border: '1px solid #dc3545',
51
+ shadow: '0 2px 4px rgba(220, 53, 69, 0.3)'
52
+ },
53
+ critical: {
54
+ emoji: '🚨',
55
+ label: 'CRITICAL',
56
+ background: 'linear-gradient(90deg, #8B0000, #FF0000)',
57
+ color: '#ffffff',
58
+ border: '2px solid #FF0000',
59
+ shadow: '0 4px 8px rgba(255, 0, 0, 0.4)'
60
+ },
61
+ success: {
62
+ emoji: '✅',
63
+ label: 'SUCCESS',
64
+ background: 'linear-gradient(90deg, #28a745, #1e7e34)',
65
+ color: '#ffffff',
66
+ border: '1px solid #28a745',
67
+ shadow: '0 2px 4px rgba(40, 167, 69, 0.3)'
68
+ }
69
+ };
70
+ /**
71
+ * Maximum allowed buffer sizes for performance
72
+ */
73
+ export const BUFFER_LIMITS = {
74
+ MIN_SIZE: 50,
75
+ DEFAULT_SIZE: 1000,
76
+ MAX_SIZE: 10000,
77
+ };
78
+ /**
79
+ * Export format definitions with extensions
80
+ */
81
+ export const EXPORT_FORMATS = {
82
+ json: { extension: '.json', mimeType: 'application/json' },
83
+ csv: { extension: '.csv', mimeType: 'text/csv' },
84
+ markdown: { extension: '.md', mimeType: 'text/markdown' },
85
+ plain: { extension: '.txt', mimeType: 'text/plain' },
86
+ html: { extension: '.html', mimeType: 'text/html' },
87
+ };
88
+ /**
89
+ * CLI command definitions
90
+ */
91
+ export const CLI_COMMANDS = {
92
+ config: 'config',
93
+ help: 'help',
94
+ themes: 'themes',
95
+ banners: 'banners',
96
+ banner: 'banner',
97
+ status: 'status',
98
+ reset: 'reset',
99
+ demo: 'demo',
100
+ export: 'export',
101
+ copy: 'copy',
102
+ 'buffer-size': 'buffer-size',
103
+ 'clear-buffer': 'clear-buffer',
104
+ 'buffer-info': 'buffer-info',
105
+ };
106
+ /**
107
+ * Time parsing constants for relative time filters
108
+ */
109
+ export const TIME_UNITS = {
110
+ ms: 1,
111
+ s: 1000,
112
+ m: 60 * 1000,
113
+ h: 60 * 60 * 1000,
114
+ d: 24 * 60 * 60 * 1000,
115
+ };
116
+ /**
117
+ * Default styling values
118
+ */
119
+ export const STYLE_DEFAULTS = {
120
+ FONT_FAMILY: 'Monaco, Consolas, monospace',
121
+ FONT_SIZE: '12px',
122
+ BORDER_RADIUS: '4px',
123
+ PADDING: '4px 8px',
124
+ };
125
+ /**
126
+ * Level priority mapping for filtering
127
+ */
128
+ export const LEVEL_PRIORITIES = {
129
+ debug: 0,
130
+ info: 1,
131
+ warn: 2,
132
+ error: 3,
133
+ critical: 4,
134
+ };
135
+ /**
136
+ * Adaptive color configurations for DevTools theme compatibility
137
+ */
138
+ export const ADAPTIVE_COLORS = {
139
+ timestamp: {
140
+ light: '#666666',
141
+ dark: '#a0a0a0',
142
+ },
143
+ messageText: {
144
+ light: '#2d3748',
145
+ dark: '#f7fafc',
146
+ },
147
+ prefix: {
148
+ light: '#2d3748',
149
+ dark: '#e2e8f0',
150
+ },
151
+ prefixBackground: {
152
+ light: '#2d3748',
153
+ dark: '#4a5568',
154
+ },
155
+ location: {
156
+ light: '#718096',
157
+ dark: '#a0aec0',
158
+ },
159
+ };
package/dist/core.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./chunks/core-DyugwSYZ.js");require("./chunks/styling-tmRDI28D.js");class CoreLogger{config;scopedPrefix;handlers=[];timers=/* @__PURE__ */new Map;groupDepth=0;constructor(o={}){this.config={...e.DEFAULT_CONFIG,...o,enableColors:!1,enableTimestamps:o.enableTimestamps??!0,enableStackTrace:o.enableStackTrace??!1}}getConfig(){return{...this.config}}setGlobalPrefix(e){this.config.globalPrefix=e}setVerbosity(e){this.config.verbosity=e}createScopedLogger(e){const o=new CoreLogger(this.config);return o.scopedPrefix=e,o.handlers=[...this.handlers],o}addHandler(e){this.handlers.push(e)}shouldLog(e){if("silent"===this.config.verbosity)return!1;const o={debug:0,info:1,warn:2,error:3,critical:4};return o[e]>=o[this.config.verbosity]}getEffectivePrefix(){const e=[this.config.globalPrefix,this.scopedPrefix].filter(Boolean);return e.length>0?e.join(":"):void 0}log(o,...t){if(!this.shouldLog(o))return;const r=this.getEffectivePrefix(),s=this.config.enableTimestamps?e.formatTimestamp():null,i=this.config.enableStackTrace?e.parseStackTrace():null,n=[];s&&n.push(`[${s.slice(11,23)}]`),n.push(`[${o.toUpperCase()}]`),r&&n.push(`[${r}]`);const l=" ".repeat(this.groupDepth)+n.join(" ");console.log(l,...t),i&&this.config.enableStackTrace&&console.log(` at ${i.file}:${i.line}:${i.column}`);const c={timestamp:s||e.formatTimestamp(),level:o,prefix:r,stackInfo:i||void 0};this.handlers.forEach(e=>{try{e.handle(o,String(t[0]||""),t,c)}catch(r){console.error("Log handler failed:",r)}})}debug(...e){this.log("debug",...e)}info(...e){this.log("info",...e)}warn(...e){this.log("warn",...e)}error(...e){this.log("error",...e)}critical(...e){this.log("critical",...e)}trace(...e){this.log("debug",...e),this.shouldLog("debug")&&console.trace(...e)}table(e,o){if(!this.shouldLog("info"))return;const t=this.getEffectivePrefix();console.log(`[TABLE]${t?` [${t}]`:""}:`),o?console.table(e,o):console.table(e)}group(e,o=!1){const t=this.getEffectivePrefix(),r=`${t?`[${t}] `:""}${e}`;o?console.groupCollapsed(r):console.group(r),this.groupDepth++}groupEnd(){this.groupDepth>0&&(console.groupEnd(),this.groupDepth--)}time(e){const o={label:e,startTime:performance.now()};this.timers.set(e,o),console.log(`[TIMER] Started: ${e}`)}timeEnd(e){const o=this.timers.get(e);if(!o)return void this.warn(`Timer '${e}' does not exist`);const t=performance.now()-o.startTime;this.timers.delete(e),console.log(`[TIMER] ${e}: ${t.toFixed(2)}ms`)}}const o=new CoreLogger;exports.CoreLogger=CoreLogger,exports.addHandler=e=>o.addHandler(e),exports.createScopedLogger=e=>o.createScopedLogger(e),exports.critical=(...e)=>o.critical(...e),exports.debug=(...e)=>o.debug(...e),exports.default=o,exports.error=(...e)=>o.error(...e),exports.group=(e,t)=>o.group(e,t),exports.groupEnd=()=>o.groupEnd(),exports.info=(...e)=>o.info(...e),exports.setGlobalPrefix=e=>o.setGlobalPrefix(e),exports.setVerbosity=e=>o.setVerbosity(e),exports.table=(e,t)=>o.table(e,t),exports.time=e=>o.time(e),exports.timeEnd=e=>o.timeEnd(e),exports.trace=(...e)=>o.trace(...e),exports.warn=(...e)=>o.warn(...e);
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./chunks/environment-Dm66zOML.js"),o=require("./chunks/formatting-DNCAV66-.js");class CoreLogger{config;scopedPrefix;handlers=[];timers=/* @__PURE__ */new Map;groupDepth=0;constructor(o={}){this.config={...e.DEFAULT_CONFIG,...o,enableColors:o.enableColors??!!e.isBrowser,enableTimestamps:o.enableTimestamps??!0,enableStackTrace:o.enableStackTrace??!1,autoDetectTheme:o.autoDetectTheme??!0}}getConfig(){return{...this.config}}setGlobalPrefix(e){this.config.globalPrefix=e}setVerbosity(e){this.config.verbosity=e}scope(e){const o=new CoreLogger(this.config);return o.scopedPrefix=e,o.handlers=[...this.handlers],o}addHandler(e){this.handlers.push(e)}shouldLog(e){if("silent"===this.config.verbosity)return!1;const o={debug:0,info:1,warn:2,error:3,critical:4};return o[e]>=o[this.config.verbosity]}getEffectivePrefix(){const e=[this.config.globalPrefix,this.scopedPrefix].filter(Boolean);return e.length>0?e.join(":"):void 0}log(t,...r){if(!this.shouldLog(t))return;const s=this.getEffectivePrefix(),i=String(r[0]||""),n=this.config.enableStackTrace?e.parseStackTrace():null,c=o.getConsoleMethod(t);if(e.isBrowser&&this.config.enableColors&&e.supportsCSSColors())try{const[o,...l]=e.createStyledOutput(t,e.LEVEL_STYLES,s,i,n,this.config.autoDetectTheme);console[c](o,...l,...r.slice(1))}catch(g){const e=o.createPlainOutput(t,i,s,n);console[c](e,...r.slice(1))}else{const e=" ".repeat(this.groupDepth)+o.createPlainOutput(t,i,s,n);console[c](e,...r.slice(1))}const l=o.createLogEntry(t,i,r,s,n),a={timestamp:l.timestamp,level:t,prefix:s,stackInfo:l.location};this.handlers.forEach(e=>{try{e.handle(t,i,r,a)}catch(g){console.error("Log handler failed:",g)}})}debug(...e){this.log("debug",...e)}info(...e){this.log("info",...e)}warn(...e){this.log("warn",...e)}error(...e){this.log("error",...e)}critical(...e){this.log("critical",...e)}trace(...e){this.log("debug",...e),this.shouldLog("debug")&&console.trace(...e)}table(t,r){if(!this.shouldLog("info"))return;const s=this.getEffectivePrefix(),i=`[TABLE]${s?` [${s}]`:""}:`;if(e.isBrowser&&"function"==typeof console.table)console.log(i),r?console.table(t,r):console.table(t);else{console.log(i);const e=o.formatTablePlain(t,r);console.log(e)}}group(o,t=!1){const r=this.getEffectivePrefix(),s=`${r?`[${r}] `:""}${o}`;if(e.isBrowser&&console.group&&console.groupCollapsed)t?console.groupCollapsed(s):console.group(s);else{const e="┌─ "+s;console.log(e)}this.groupDepth++}groupEnd(){if(this.groupDepth>0){if(e.isBrowser&&console.groupEnd)console.groupEnd();else{const e="└─ (end group)";console.log(e)}this.groupDepth--}}time(e){const t={label:e,startTime:this.getPerformanceNow()};this.timers.set(e,t);const r=this.getEffectivePrefix(),s=`Timer started: ${e}`,i=o.createPlainOutput("info",s,r);console.log(i)}timeEnd(e){const t=this.timers.get(e);if(!t)return void this.warn(`Timer '${e}' does not exist`);const r=this.getPerformanceNow()-t.startTime;this.timers.delete(e);const s=this.getEffectivePrefix(),i=`Timer ended: ${e} - ${r.toFixed(2)}ms`,n=o.createPlainOutput("info",i,s);console.log(n)}getPerformanceNow(){if("undefined"!=typeof performance&&performance.now)return performance.now();if(e.isNode&&process.hrtime){const[e,o]=process.hrtime();return 1e3*e+o/1e6}return Date.now()}}const t=new CoreLogger;exports.CoreLogger=CoreLogger,exports.addHandler=e=>t.addHandler(e),exports.critical=(...e)=>t.critical(...e),exports.debug=(...e)=>t.debug(...e),exports.default=t,exports.error=(...e)=>t.error(...e),exports.group=(e,o)=>t.group(e,o),exports.groupEnd=()=>t.groupEnd(),exports.info=(...e)=>t.info(...e),exports.scope=e=>t.scope(e),exports.setGlobalPrefix=e=>t.setGlobalPrefix(e),exports.setVerbosity=e=>t.setVerbosity(e),exports.table=(e,o)=>t.table(e,o),exports.time=e=>t.time(e),exports.timeEnd=e=>t.timeEnd(e),exports.trace=(...e)=>t.trace(...e),exports.warn=(...e)=>t.warn(...e);
2
2
  //# sourceMappingURL=core.cjs.map