@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
@@ -1,751 +0,0 @@
1
- /**
2
- * Banner variants for different display capabilities
3
- */
4
- export declare const BANNER_VARIANTS: {
5
- simple: {
6
- text: string;
7
- style: string;
8
- };
9
- ascii: {
10
- text: string;
11
- style: string;
12
- };
13
- unicode: {
14
- text: string;
15
- style: string;
16
- };
17
- svg: {
18
- text: string;
19
- style: string;
20
- };
21
- animated: {
22
- text: string;
23
- style: string;
24
- };
25
- };
26
-
27
- /**
28
- * Banner types for different visual approaches
29
- */
30
- export declare type BannerType = 'simple' | 'ascii' | 'unicode' | 'svg' | 'animated';
31
-
32
- /**
33
- * Available banner types
34
- *
35
- * @example
36
- * ```typescript
37
- * import { bannerTypes } from '@mks2508/better-logger/styling';
38
- *
39
- * console.log('Available banners:', bannerTypes);
40
- * ```
41
- */
42
- export declare const bannerTypes: string[];
43
-
44
- /**
45
- * Buffer statistics for log management
46
- */
47
- declare interface BufferStats {
48
- size: number;
49
- maxSize: number;
50
- usage: number;
51
- oldestLog?: Date;
52
- newestLog?: Date;
53
- levelCounts: Record<LogLevel, number>;
54
- }
55
-
56
- export declare const createScopedLogger: (prefix: string) => Logger;
57
-
58
- /**
59
- * Utility functions for creating custom styles
60
- *
61
- * @example
62
- * ```typescript
63
- * import { createStyle, StyleBuilder } from '@mks2508/better-logger/styling';
64
- *
65
- * const myStyle = createStyle()
66
- * .bg('linear-gradient(45deg, #ff6b6b, #feca57)')
67
- * .color('white')
68
- * .padding('10px')
69
- * .build();
70
- *
71
- * console.log('%cCustom Message', myStyle);
72
- * ```
73
- */
74
- export declare const createStyle: () => StyleBuilder;
75
-
76
- export declare const critical: (...args: any[]) => void;
77
-
78
- /**
79
- * Export individual styled logging methods
80
- */
81
- export declare const debug: (...args: any[]) => void;
82
-
83
- export declare const error: (...args: any[]) => void;
84
-
85
- /**
86
- * Export filter options
87
- */
88
- declare interface ExportFilters {
89
- levels?: LogLevel[];
90
- since?: Date | string | number;
91
- until?: Date | string | number;
92
- prefixes?: string[];
93
- excludePrefixes?: string[];
94
- withStackTrace?: boolean;
95
- errorsOnly?: boolean;
96
- last?: number;
97
- first?: number;
98
- search?: string;
99
- groupBy?: 'level' | 'prefix' | 'hour' | 'date';
100
- }
101
-
102
- /**
103
- * Export formats for log data
104
- */
105
- declare type ExportFormat = 'json' | 'csv' | 'markdown' | 'plain' | 'html';
106
-
107
- /**
108
- * Export log handler with circular buffer and multiple export formats
109
- */
110
- declare class ExportLogHandler implements ILogHandler {
111
- private buffer;
112
- private maxSize;
113
- private groupDepth;
114
- private currentGroup?;
115
- constructor(maxSize?: number);
116
- /**
117
- * Handle incoming log and store in buffer
118
- */
119
- handle(level: LogLevel, message: string, args: any[], metadata: LogMetadata): void;
120
- /**
121
- * Set group tracking for nested logs
122
- */
123
- setGroupInfo(depth: number, groupName?: string): void;
124
- /**
125
- * Get buffer statistics
126
- */
127
- getBufferStats(): BufferStats;
128
- /**
129
- * Clear the buffer
130
- */
131
- clearBuffer(): void;
132
- /**
133
- * Set buffer size (with limits)
134
- */
135
- setBufferSize(size: number): void;
136
- /**
137
- * Filter logs based on criteria
138
- */
139
- private filterLogs;
140
- /**
141
- * Export logs in JSON format
142
- */
143
- private exportJSON;
144
- /**
145
- * Export logs in CSV format
146
- */
147
- private exportCSV;
148
- /**
149
- * Export logs in Markdown format
150
- */
151
- private exportMarkdown;
152
- /**
153
- * Export logs in plain text format
154
- */
155
- private exportPlain;
156
- /**
157
- * Export logs in HTML format
158
- */
159
- private exportHTML;
160
- /**
161
- * Get emoji for log level
162
- */
163
- private getLevelEmoji;
164
- /**
165
- * Main export function
166
- */
167
- export(format: ExportFormat, filters?: ExportFilters, options?: ExportOptions): ExportResult;
168
- /**
169
- * Copy to clipboard with fallback
170
- */
171
- copyToClipboard(format: ExportFormat, filters?: ExportFilters, options?: ExportOptions): Promise<boolean>;
172
- /**
173
- * Get all logs (for debugging)
174
- */
175
- getAllLogs(): LogEntry[];
176
- }
177
-
178
- /**
179
- * Export options for different formats
180
- */
181
- declare interface ExportOptions {
182
- minimal?: boolean;
183
- compact?: boolean;
184
- styled?: boolean;
185
- includeMetadata?: boolean;
186
- groupBy?: ExportFilters['groupBy'];
187
- }
188
-
189
- /**
190
- * Export result with metadata
191
- */
192
- declare interface ExportResult {
193
- format: string;
194
- data: string;
195
- metadata: {
196
- totalLogs: number;
197
- filteredLogs: number;
198
- exportedAt: string;
199
- filters?: ExportFilters;
200
- options?: ExportOptions;
201
- };
202
- }
203
-
204
- export declare const group: (label: string, collapsed?: boolean) => void;
205
-
206
- export declare const groupEnd: () => void;
207
-
208
- /**
209
- * Interface for custom log handlers (extensibility)
210
- */
211
- declare interface ILogHandler {
212
- handle(level: LogLevel, message: string, args: any[], metadata: LogMetadata): void;
213
- }
214
-
215
- export declare const info: (...args: any[]) => void;
216
-
217
- /**
218
- * Style configuration for each log level
219
- */
220
- declare interface LevelStyleConfig {
221
- emoji: string;
222
- label: string;
223
- background: string;
224
- color: string;
225
- border: string;
226
- shadow: string;
227
- }
228
-
229
- /**
230
- * Supported log levels in hierarchical order (debug < info < warn < error < critical)
231
- */
232
- declare const LOG_LEVELS: {
233
- readonly debug: 0;
234
- readonly info: 1;
235
- readonly warn: 2;
236
- readonly error: 3;
237
- readonly critical: 4;
238
- };
239
-
240
- export declare const logAnimated: (message: string, duration?: number) => void;
241
-
242
- /**
243
- * Stored log entry for export functionality
244
- */
245
- declare interface LogEntry {
246
- id: string;
247
- timestamp: string;
248
- level: LogLevel;
249
- prefix?: string;
250
- message: string;
251
- args: any[];
252
- location?: StackInfo;
253
- groupInfo?: {
254
- depth: number;
255
- groupName?: string;
256
- };
257
- }
258
-
259
- /**
260
- * Main Logger class implementing state-of-the-art logging capabilities
261
- */
262
- declare class Logger {
263
- private config;
264
- private scopedPrefix?;
265
- private handlers;
266
- private timers;
267
- private groupDepth;
268
- private exportHandler?;
269
- private cliProcessor?;
270
- /**
271
- * Creates a new Logger instance
272
- */
273
- constructor(config?: Partial<LoggerConfig>);
274
- /**
275
- * Get current configuration
276
- */
277
- getConfig(): LoggerConfig;
278
- /**
279
- * Update configuration
280
- */
281
- updateConfig(updates: Partial<LoggerConfig>): void;
282
- /**
283
- * Sets the global prefix for all log messages
284
- */
285
- setGlobalPrefix(prefix: string): void;
286
- /**
287
- * Sets the verbosity level for filtering log output
288
- */
289
- setVerbosity(level: Verbosity): void;
290
- /**
291
- * Sets the logger theme
292
- */
293
- setTheme(theme: ThemeVariant): void;
294
- /**
295
- * Set banner type for initialization display
296
- */
297
- setBannerType(bannerType: BannerType): void;
298
- /**
299
- * Reset logger to default configuration
300
- */
301
- resetConfig(): void;
302
- /**
303
- * Creates a scoped logger with a specific prefix
304
- */
305
- createScopedLogger(prefix: string): Logger;
306
- /**
307
- * Adds a custom log handler for extensibility
308
- */
309
- addHandler(handler: ILogHandler): void;
310
- /**
311
- * Get all registered handlers
312
- */
313
- getHandlers(): ILogHandler[];
314
- /**
315
- * Get export handler if available
316
- */
317
- getExportHandler(): ExportLogHandler | undefined;
318
- /**
319
- * Checks if a log level should be output based on current verbosity
320
- */
321
- private shouldLog;
322
- /**
323
- * Gets the effective prefix (global + scoped)
324
- */
325
- private getEffectivePrefix;
326
- /**
327
- * Core logging method that handles styling and formatting
328
- */
329
- private log;
330
- /**
331
- * Logs debug information (lowest priority)
332
- */
333
- debug(...args: any[]): void;
334
- /**
335
- * Logs informational messages
336
- */
337
- info(...args: any[]): void;
338
- /**
339
- * Logs warning messages
340
- */
341
- warn(...args: any[]): void;
342
- /**
343
- * Logs error messages
344
- */
345
- error(...args: any[]): void;
346
- /**
347
- * Logs success messages (special info level)
348
- */
349
- success(...args: any[]): void;
350
- /**
351
- * Logs trace information (detailed debugging)
352
- */
353
- trace(...args: any[]): void;
354
- /**
355
- * Logs critical errors (highest priority)
356
- */
357
- critical(...args: any[]): void;
358
- /**
359
- * Displays data in a table format
360
- */
361
- table(data: any, columns?: string[]): void;
362
- /**
363
- * Starts a collapsible group in the console
364
- */
365
- group(label: string, collapsed?: boolean): void;
366
- /**
367
- * Ends the current console group
368
- */
369
- groupEnd(): void;
370
- /**
371
- * Starts a timer with the given label
372
- */
373
- time(label: string): void;
374
- /**
375
- * Ends a timer and logs the elapsed time
376
- */
377
- timeEnd(label: string): void;
378
- /**
379
- * Display banner with specified or configured type
380
- */
381
- showBanner(bannerType?: BannerType): void;
382
- /**
383
- * Log with SVG background image
384
- */
385
- logWithSVG(message: string, svgContent?: string, options?: StyleOptions): void;
386
- /**
387
- * Log with animated background gradient
388
- */
389
- logAnimated(message: string, duration?: number): void;
390
- /**
391
- * Groups logs by a specific property using modern Object.groupBy (when available)
392
- */
393
- logGrouped<T>(items: T[], groupBy: (item: T) => string): void;
394
- /**
395
- * CLI command processor for logger configuration and export
396
- */
397
- cli(command: string): Promise<void>;
398
- }
399
-
400
- /**
401
- * Configuration interface for logger instances
402
- */
403
- declare interface LoggerConfig {
404
- globalPrefix?: string;
405
- verbosity: Verbosity;
406
- enableColors: boolean;
407
- enableTimestamps: boolean;
408
- enableStackTrace: boolean;
409
- theme?: ThemeVariant;
410
- bannerType?: BannerType;
411
- bufferSize?: number;
412
- }
413
-
414
- /**
415
- * Log level type derived from LOG_LEVELS keys
416
- */
417
- declare type LogLevel = keyof typeof LOG_LEVELS;
418
-
419
- /**
420
- * Metadata associated with each log entry
421
- */
422
- declare interface LogMetadata {
423
- timestamp: string;
424
- level: LogLevel;
425
- prefix?: string;
426
- stackInfo?: StackInfo;
427
- group?: string;
428
- }
429
-
430
- export declare const logWithSVG: (message: string, svgContent?: string, options?: StyleOptions) => void;
431
-
432
- export declare const setBannerType: (bannerType: BannerType) => void;
433
-
434
- export declare const setGlobalPrefix: (prefix: string) => void;
435
-
436
- export declare const setTheme: (theme: ThemeVariant) => void;
437
-
438
- export declare const setVerbosity: (level: any) => void;
439
-
440
- export declare const showBanner: (bannerType?: BannerType) => void;
441
-
442
- /**
443
- * Display initialization banner
444
- *
445
- * @param bannerType - Type of banner to display
446
- *
447
- * @example
448
- * ```typescript
449
- * import { showInitBanner } from '@mks2508/better-logger/styling';
450
- *
451
- * showInitBanner('animated');
452
- * ```
453
- */
454
- export declare const showInitBanner: (bannerType?: BannerType) => void;
455
-
456
- /**
457
- * Parsed stack trace information
458
- */
459
- declare interface StackInfo {
460
- file: string;
461
- line: number;
462
- column: number;
463
- function?: string;
464
- }
465
-
466
- /**
467
- * @fileoverview StyleBuilder class for Advanced Logger
468
- */
469
- /**
470
- * Utility class for creating dynamic console styles with method chaining
471
- */
472
- export declare class StyleBuilder {
473
- private styles;
474
- constructor(baseStyle?: string);
475
- /**
476
- * Add background color or gradient
477
- */
478
- bg(background: string): StyleBuilder;
479
- /**
480
- * Add text color
481
- */
482
- color(color: string): StyleBuilder;
483
- /**
484
- * Add border styling
485
- */
486
- border(border: string): StyleBuilder;
487
- /**
488
- * Add box shadow
489
- */
490
- shadow(shadow: string): StyleBuilder;
491
- /**
492
- * Add padding
493
- */
494
- padding(padding: string): StyleBuilder;
495
- /**
496
- * Add margin
497
- */
498
- margin(margin: string): StyleBuilder;
499
- /**
500
- * Add border radius
501
- */
502
- rounded(radius?: string): StyleBuilder;
503
- /**
504
- * Add font weight
505
- */
506
- bold(): StyleBuilder;
507
- /**
508
- * Add font styling
509
- */
510
- font(font: string): StyleBuilder;
511
- /**
512
- * Add font size
513
- */
514
- size(size: string): StyleBuilder;
515
- /**
516
- * Add line height
517
- */
518
- lineHeight(height: string): StyleBuilder;
519
- /**
520
- * Add text decoration
521
- */
522
- underline(): StyleBuilder;
523
- /**
524
- * Add text transform
525
- */
526
- uppercase(): StyleBuilder;
527
- /**
528
- * Add opacity
529
- */
530
- opacity(value: number): StyleBuilder;
531
- /**
532
- * Add display property
533
- */
534
- display(value: string): StyleBuilder;
535
- /**
536
- * Add position property
537
- */
538
- position(value: string): StyleBuilder;
539
- /**
540
- * Add transform property
541
- */
542
- transform(value: string): StyleBuilder;
543
- /**
544
- * Add animation property
545
- */
546
- animation(value: string): StyleBuilder;
547
- /**
548
- * Add transition property
549
- */
550
- transition(value: string): StyleBuilder;
551
- /**
552
- * Add cursor property
553
- */
554
- cursor(value: string): StyleBuilder;
555
- /**
556
- * Add any custom CSS property
557
- */
558
- custom(property: string, value: string): StyleBuilder;
559
- /**
560
- * Add any CSS property (alias for custom)
561
- */
562
- css(property: string, value: string): StyleBuilder;
563
- /**
564
- * Build the final CSS string
565
- */
566
- build(): string;
567
- /**
568
- * Clear all styles and start fresh
569
- */
570
- clear(): StyleBuilder;
571
- /**
572
- * Clone this StyleBuilder with the same styles
573
- */
574
- clone(): StyleBuilder;
575
- /**
576
- * Merge another StyleBuilder's styles into this one
577
- */
578
- merge(other: StyleBuilder): StyleBuilder;
579
- }
580
-
581
- /**
582
- * Enhanced Logger with advanced styling capabilities
583
- *
584
- * @example
585
- * ```typescript
586
- * import { StyledLogger } from '@mks2508/better-logger/styling';
587
- *
588
- * const logger = new StyledLogger();
589
- * logger.setTheme('neon');
590
- * logger.logAnimated('🌟 Animated message!');
591
- * logger.logWithSVG('Custom SVG Logo', svgContent);
592
- * ```
593
- */
594
- export declare class StyledLogger extends Logger {
595
- /**
596
- * Log with SVG background image
597
- *
598
- * @param message - The message to log
599
- * @param svgContent - SVG content as string (optional)
600
- * @param options - Styling options
601
- *
602
- * @example
603
- * ```typescript
604
- * logger.logWithSVG('My App', '<svg>...</svg>', {
605
- * width: 400,
606
- * height: 80,
607
- * padding: '40px 200px'
608
- * });
609
- * ```
610
- */
611
- logWithSVG(message: string, svgContent?: string, options?: StyleOptions): void;
612
- /**
613
- * Log with animated background gradient
614
- *
615
- * @param message - The message to log
616
- * @param duration - Animation duration in seconds
617
- *
618
- * @example
619
- * ```typescript
620
- * logger.logAnimated('🚀 Loading...', 2);
621
- * ```
622
- */
623
- logAnimated(message: string, duration?: number): void;
624
- /**
625
- * Display banner with specified type
626
- *
627
- * @param bannerType - Type of banner to display
628
- *
629
- * @example
630
- * ```typescript
631
- * logger.showBanner('animated');
632
- * ```
633
- */
634
- showBanner(bannerType?: BannerType): void;
635
- /**
636
- * Set banner type for initialization display
637
- *
638
- * @param bannerType - Type of banner to display
639
- *
640
- * @example
641
- * ```typescript
642
- * logger.setBannerType('svg');
643
- * ```
644
- */
645
- setBannerType(bannerType: BannerType): void;
646
- /**
647
- * Sets the logger theme with visual banner
648
- *
649
- * @param theme - Theme variant to apply
650
- *
651
- * @example
652
- * ```typescript
653
- * logger.setTheme('cyberpunk'); // Shows themed banner
654
- * ```
655
- */
656
- setTheme(theme: ThemeVariant): void;
657
- }
658
-
659
- declare const styledLogger: StyledLogger;
660
- export default styledLogger;
661
-
662
- /**
663
- * Options for styling components
664
- */
665
- export declare interface StyleOptions {
666
- width?: number;
667
- height?: number;
668
- padding?: string;
669
- }
670
-
671
- /**
672
- * Pre-defined style presets for common use cases
673
- */
674
- export declare const StylePresets: {
675
- success: () => StyleBuilder;
676
- error: () => StyleBuilder;
677
- warning: () => StyleBuilder;
678
- info: () => StyleBuilder;
679
- debug: () => StyleBuilder;
680
- muted: () => StyleBuilder;
681
- accent: () => StyleBuilder;
682
- neon: () => StyleBuilder;
683
- };
684
-
685
- /**
686
- * Pre-built style presets
687
- *
688
- * @example
689
- * ```typescript
690
- * import { stylePresets } from '@mks2508/better-logger/styling';
691
- *
692
- * console.log('%cSuccess!', stylePresets.success);
693
- * console.log('%cError!', stylePresets.error);
694
- * ```
695
- */
696
- export declare const stylePresets: {
697
- success: string;
698
- error: string;
699
- warning: string;
700
- info: string;
701
- accent: string;
702
- };
703
-
704
- export declare const success: (...args: any[]) => void;
705
-
706
- export declare const table: (data: any, columns?: string[]) => void;
707
-
708
- /**
709
- * Theme-specific banners for enhanced visual theming
710
- */
711
- export declare const THEME_BANNERS: Record<ThemeVariant, {
712
- simple: string;
713
- style: string;
714
- }>;
715
-
716
- /**
717
- * Theme configurations for different visual styles
718
- */
719
- export declare const THEME_PRESETS: Record<ThemeVariant, Record<string, LevelStyleConfig>>;
720
-
721
- /**
722
- * Available themes for the logger
723
- *
724
- * @example
725
- * ```typescript
726
- * import { themes } from '@mks2508/better-logger/styling';
727
- *
728
- * console.log('Available themes:', Object.keys(themes));
729
- * ```
730
- */
731
- export declare const themes: string[];
732
-
733
- /**
734
- * Theme variants for different visual styles
735
- */
736
- export declare type ThemeVariant = 'default' | 'dark' | 'light' | 'neon' | 'minimal' | 'cyberpunk';
737
-
738
- export declare const time: (label: string) => void;
739
-
740
- export declare const timeEnd: (label: string) => void;
741
-
742
- export declare const trace: (...args: any[]) => void;
743
-
744
- /**
745
- * Verbosity level type for filtering logs
746
- */
747
- declare type Verbosity = LogLevel | 'silent';
748
-
749
- export declare const warn: (...args: any[]) => void;
750
-
751
- export { }