@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,18 @@
1
+ /**
2
+ * @fileoverview Comprehensive examples and demonstrations of Better Logger
3
+ */
4
+ export declare function demonstrateBanners(): void;
5
+ export declare function demonstrateThemes(): void;
6
+ export declare function demonstrateSVG(): void;
7
+ export declare function demonstrateAnimations(): void;
8
+ export declare function demonstrateCLI(): void;
9
+ export declare function demonstrateExports(): void;
10
+ export declare function demonstrateBasicLogging(): void;
11
+ export declare function demonstrateTable(): void;
12
+ export declare function demonstrateGrouping(): void;
13
+ export declare function demonstrateTiming(): void;
14
+ export declare function demonstrateScopedLogger(): void;
15
+ export declare function demonstrateTrace(): void;
16
+ export declare function demonstrateCustomStyles(): void;
17
+ export declare function demonstrateAllFeatures(): void;
18
+ //# sourceMappingURL=example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../src/example.ts"],"names":[],"mappings":"AAAA;;GAEG;AA0BH,wBAAgB,kBAAkB,SAQjC;AAED,wBAAgB,iBAAiB,SAUhC;AAED,wBAAgB,cAAc,SAW7B;AAED,wBAAgB,qBAAqB,SAGpC;AAED,wBAAgB,cAAc,SAgB7B;AAED,wBAAgB,kBAAkB,SAWjC;AAGD,wBAAgB,uBAAuB,SAUtC;AAED,wBAAgB,gBAAgB,SAS/B;AAED,wBAAgB,mBAAmB,SAgBlC;AAED,wBAAgB,iBAAiB,SAShC;AAED,wBAAgB,uBAAuB,SAWtC;AAED,wBAAgB,gBAAgB,SAQ/B;AAED,wBAAgB,uBAAuB,SActC;AAGD,wBAAgB,sBAAsB,SAcrC"}
@@ -0,0 +1,154 @@
1
+ /**
2
+ * @fileoverview Comprehensive examples and demonstrations of Better Logger
3
+ */
4
+ import logger, { debug, info, warn, error, success, critical, scope, setGlobalPrefix, setVerbosity, setTheme, showBanner, logWithSVG, logAnimated, cli, createStyle, stylePresets } from './index.js';
5
+ // Visual features demonstrations
6
+ export function demonstrateBanners() {
7
+ info('🎨 Banner System Demo');
8
+ showBanner('simple');
9
+ setTimeout(() => showBanner('ascii'), 1000);
10
+ setTimeout(() => showBanner('unicode'), 2000);
11
+ setTimeout(() => showBanner('svg'), 3000);
12
+ setTimeout(() => showBanner('animated'), 4000);
13
+ }
14
+ export function demonstrateThemes() {
15
+ info('🌈 Theme System Demo');
16
+ const themes = ['default', 'dark', 'neon', 'cyberpunk', 'retro'];
17
+ themes.forEach((theme, index) => {
18
+ setTimeout(() => {
19
+ setTheme(theme);
20
+ info(`Theme switched to: ${theme}`);
21
+ }, index * 1500);
22
+ });
23
+ }
24
+ export function demonstrateSVG() {
25
+ const logoSVG = `<svg width="100" height="50" viewBox="0 0 100 50">
26
+ <rect width="100" height="50" fill="#667eea"/>
27
+ <text x="50" y="30" font-family="Arial" font-size="12" fill="white" text-anchor="middle">LOGO</text>
28
+ </svg>`;
29
+ logWithSVG('🖼️ Custom SVG Background', logoSVG, {
30
+ width: 300,
31
+ height: 60,
32
+ padding: '20px 100px'
33
+ });
34
+ }
35
+ export function demonstrateAnimations() {
36
+ logAnimated('✨ Loading animation...', 3);
37
+ setTimeout(() => logAnimated('🚀 Animation complete!', 2), 3500);
38
+ }
39
+ export function demonstrateCLI() {
40
+ info('💻 CLI Commands Demo');
41
+ const commands = [
42
+ '/config theme:neon',
43
+ '/banner ascii',
44
+ '/verbose debug',
45
+ '/prefix DEMO'
46
+ ];
47
+ commands.forEach((cmd, index) => {
48
+ setTimeout(() => {
49
+ info(`Executing: ${cmd}`);
50
+ cli(cmd);
51
+ }, index * 1500);
52
+ });
53
+ }
54
+ export function demonstrateExports() {
55
+ info('📤 Export functionality would be demonstrated here');
56
+ info('Note: Export features require ExportLogger from /exports module');
57
+ const sampleData = [
58
+ { timestamp: new Date().toISOString(), level: 'info', message: 'Sample log 1' },
59
+ { timestamp: new Date().toISOString(), level: 'error', message: 'Sample log 2' },
60
+ { timestamp: new Date().toISOString(), level: 'warn', message: 'Sample log 3' }
61
+ ];
62
+ logger.table(sampleData, ['timestamp', 'level', 'message']);
63
+ }
64
+ // Core features demonstrations
65
+ export function demonstrateBasicLogging() {
66
+ setGlobalPrefix('DEMO');
67
+ setVerbosity('debug');
68
+ debug('🐞 Debug information', { config: { mode: 'development' } });
69
+ info('ℹ️ Application started successfully');
70
+ warn('⚠️ This is a warning message');
71
+ error('❌ An error occurred', new Error('Sample error'));
72
+ success('✅ User authentication successful');
73
+ critical('🔥 Critical system failure detected');
74
+ }
75
+ export function demonstrateTable() {
76
+ const userData = [
77
+ { id: 1, name: 'John Doe', email: 'john@example.com', status: 'active' },
78
+ { id: 2, name: 'Jane Smith', email: 'jane@example.com', status: 'inactive' },
79
+ { id: 3, name: 'Bob Johnson', email: 'bob@example.com', status: 'active' }
80
+ ];
81
+ logger.table(userData);
82
+ logger.table(userData, ['name', 'email']);
83
+ }
84
+ export function demonstrateGrouping() {
85
+ logger.group('🔍 User Analysis');
86
+ info('Analyzing user data...');
87
+ logger.group('📊 Statistics', false);
88
+ info('Total users: 150');
89
+ info('Active users: 120');
90
+ info('New this month: 25');
91
+ logger.groupEnd();
92
+ logger.group('🎯 Top Users');
93
+ success('Premium user: Alice Johnson');
94
+ success('Most active: Bob Smith');
95
+ logger.groupEnd();
96
+ logger.groupEnd();
97
+ }
98
+ export function demonstrateTiming() {
99
+ logger.time('api-request');
100
+ info('🌐 Making API request...');
101
+ setTimeout(() => {
102
+ logger.timeEnd('api-request');
103
+ success('✅ API request completed');
104
+ }, Math.random() * 2000 + 500);
105
+ }
106
+ export function demonstrateScopedLogger() {
107
+ const apiLogger = scope('API');
108
+ const dbLogger = scope('DB');
109
+ const authLogger = scope('AUTH');
110
+ apiLogger.info('🌐 Fetching user data', { endpoint: '/api/users' });
111
+ dbLogger.debug('💾 Database query executed', { query: 'SELECT * FROM users LIMIT 10' });
112
+ authLogger.success('🔐 User authentication successful', { userId: 12345 });
113
+ apiLogger.warn('⚠️ Rate limit approaching', { remaining: 10 });
114
+ dbLogger.error('❌ Connection timeout', { timeout: '5s' });
115
+ }
116
+ export function demonstrateTrace() {
117
+ function deepFunction() {
118
+ function deeperFunction() {
119
+ logger.trace('🔍 Deep trace call with full stack');
120
+ }
121
+ deeperFunction();
122
+ }
123
+ deepFunction();
124
+ }
125
+ export function demonstrateCustomStyles() {
126
+ const customStyle = createStyle()
127
+ .bg('linear-gradient(135deg, #ff6b6b 0%, #feca57 100%)')
128
+ .color('white')
129
+ .padding('12px 20px')
130
+ .rounded('10px')
131
+ .shadow('0 4px 15px rgba(0,0,0,0.3)')
132
+ .bold()
133
+ .build();
134
+ console.log('%c🎨 Custom Styled Message', customStyle);
135
+ console.log('%c✅ Success Style', stylePresets.success);
136
+ console.log('%c❌ Error Style', stylePresets.error);
137
+ console.log('%c⚠️ Warning Style', stylePresets.warning);
138
+ }
139
+ // Comprehensive demonstration
140
+ export function demonstrateAllFeatures() {
141
+ info('🌟 Starting comprehensive Better Logger demonstration...');
142
+ setTimeout(() => demonstrateBanners(), 500);
143
+ setTimeout(() => demonstrateBasicLogging(), 6000);
144
+ setTimeout(() => demonstrateCustomStyles(), 8000);
145
+ setTimeout(() => demonstrateGrouping(), 10000);
146
+ setTimeout(() => demonstrateTiming(), 13000);
147
+ setTimeout(() => demonstrateScopedLogger(), 16000);
148
+ setTimeout(() => demonstrateThemes(), 18000);
149
+ setTimeout(() => {
150
+ success('🎉 Demonstration complete! Check your console for all the styled outputs.');
151
+ }, 25000);
152
+ }
153
+ // Auto-run basic demo on import
154
+ demonstrateBasicLogging();
@@ -0,0 +1,203 @@
1
+ /**
2
+ * @fileoverview Exports Module - Export and remote logging capabilities
3
+ * @version 0.0.1
4
+ *
5
+ * This module provides export functionality for logs including CSV, JSON, XML formats
6
+ * and remote logging capabilities for sending logs to external services.
7
+ */
8
+ import { Logger } from './Logger.js';
9
+ import type { LogLevel, Verbosity, ILogHandler } from './types/index.js';
10
+ /**
11
+ * Logger with export and remote capabilities
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * import { ExportLogger } from '@mks2508/better-logger/exports';
16
+ *
17
+ * const logger = new ExportLogger({ bufferSize: 1000 });
18
+ *
19
+ * // Log some data
20
+ * logger.info('User logged in', { userId: 123 });
21
+ * logger.error('Failed to process', { error: 'timeout' });
22
+ *
23
+ * // Export logs
24
+ * const csvData = await logger.exportLogs('csv');
25
+ * const jsonData = await logger.exportLogs('json');
26
+ *
27
+ * // Setup remote logging
28
+ * logger.addRemoteHandler('https://api.myapp.com/logs', 'api-key');
29
+ * ```
30
+ */
31
+ export declare class ExportLogger extends Logger {
32
+ private exportLogHandler?;
33
+ private remoteHandlers;
34
+ constructor(config?: {
35
+ bufferSize?: number;
36
+ } & any);
37
+ /**
38
+ * Export logs in specified format
39
+ *
40
+ * @param format - Export format (csv, json, xml)
41
+ * @param options - Export options
42
+ * @returns Promise resolving to exported data
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * const csvData = await logger.exportLogs('csv');
47
+ * const jsonData = await logger.exportLogs('json', {
48
+ * filter: { level: 'error' },
49
+ * limit: 100
50
+ * });
51
+ * ```
52
+ */
53
+ exportLogs(format: 'csv' | 'json' | 'xml', options?: {
54
+ filter?: {
55
+ level?: LogLevel;
56
+ from?: Date;
57
+ to?: Date;
58
+ };
59
+ limit?: number;
60
+ }): Promise<string>;
61
+ /**
62
+ * Get current log buffer
63
+ *
64
+ * @returns Array of log entries
65
+ *
66
+ * @example
67
+ * ```typescript
68
+ * const logs = logger.getLogs();
69
+ * console.log(`Buffered ${logs.length} log entries`);
70
+ * ```
71
+ */
72
+ getLogs(): any[];
73
+ /**
74
+ * Clear the log buffer
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * logger.clearLogs();
79
+ * ```
80
+ */
81
+ clearLogs(): void;
82
+ /**
83
+ * Get log statistics
84
+ *
85
+ * @returns Statistics object with counts by level
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * const stats = logger.getLogStats();
90
+ * console.log(`Errors: ${stats.error}, Warnings: ${stats.warn}`);
91
+ * ```
92
+ */
93
+ getLogStats(): Record<string, number>;
94
+ /**
95
+ * Add remote logging handler
96
+ *
97
+ * @param endpoint - Remote endpoint URL
98
+ * @param apiKey - Optional API key for authentication
99
+ *
100
+ * @example
101
+ * ```typescript
102
+ * logger.addRemoteHandler('https://logs.myservice.com/api', 'secret-key');
103
+ * ```
104
+ */
105
+ addRemoteHandler(endpoint: string, apiKey?: string): void;
106
+ /**
107
+ * Remove all remote handlers
108
+ *
109
+ * @example
110
+ * ```typescript
111
+ * logger.clearRemoteHandlers();
112
+ * ```
113
+ */
114
+ clearRemoteHandlers(): void;
115
+ /**
116
+ * Flush all remote handlers (force send pending logs)
117
+ *
118
+ * @example
119
+ * ```typescript
120
+ * await logger.flushRemoteHandlers();
121
+ * ```
122
+ */
123
+ flushRemoteHandlers(): Promise<void>;
124
+ }
125
+ declare const exportLogger: ExportLogger;
126
+ /**
127
+ * Export management utilities
128
+ */
129
+ export declare const exportUtils: {
130
+ /**
131
+ * Export current logs as CSV
132
+ */
133
+ exportCSV(options?: any): Promise<string>;
134
+ /**
135
+ * Export current logs as JSON
136
+ */
137
+ exportJSON(options?: any): Promise<string>;
138
+ /**
139
+ * Export current logs as XML
140
+ */
141
+ exportXML(options?: any): Promise<string>;
142
+ /**
143
+ * Get log statistics
144
+ */
145
+ getStats(): Record<string, number>;
146
+ /**
147
+ * Clear all logs
148
+ */
149
+ clear(): void;
150
+ };
151
+ /**
152
+ * Remote logging utilities
153
+ */
154
+ export declare const remoteUtils: {
155
+ /**
156
+ * Add remote logging endpoint
157
+ */
158
+ addEndpoint(url: string, apiKey?: string): void;
159
+ /**
160
+ * Clear all remote endpoints
161
+ */
162
+ clearEndpoints(): void;
163
+ /**
164
+ * Flush all remote logs
165
+ */
166
+ flush(): Promise<void>;
167
+ };
168
+ /**
169
+ * Export individual logging methods with export capabilities
170
+ */
171
+ export declare const debug: (...args: any[]) => void;
172
+ export declare const info: (...args: any[]) => void;
173
+ export declare const warn: (...args: any[]) => void;
174
+ export declare const error: (...args: any[]) => void;
175
+ export declare const success: (...args: any[]) => void;
176
+ export declare const critical: (...args: any[]) => void;
177
+ export declare const trace: (...args: any[]) => void;
178
+ export declare const table: (data: any, columns?: string[]) => void;
179
+ export declare const group: (label: string, collapsed?: boolean) => void;
180
+ export declare const groupEnd: () => void;
181
+ export declare const time: (label: string) => void;
182
+ export declare const timeEnd: (label: string) => void;
183
+ export declare const setGlobalPrefix: (prefix: string) => void;
184
+ export declare const scope: (prefix: string) => import("./ScopedLogger.js").ScopedLogger;
185
+ export declare const setVerbosity: (level: Verbosity) => void;
186
+ export declare const addHandler: (handler: ILogHandler) => void;
187
+ /**
188
+ * Export functionality
189
+ */
190
+ export declare const exportLogs: (format: "csv" | "json" | "xml", options?: any) => Promise<string>;
191
+ export declare const getLogs: () => any[];
192
+ export declare const clearLogs: () => void;
193
+ export declare const getLogStats: () => Record<string, number>;
194
+ /**
195
+ * Remote logging functionality
196
+ */
197
+ export declare const addRemoteHandler: (endpoint: string, apiKey?: string) => void;
198
+ export declare const clearRemoteHandlers: () => void;
199
+ export declare const flushRemoteHandlers: () => Promise<void>;
200
+ export default exportLogger;
201
+ export { ExportLogHandler, RemoteLogHandler } from './handlers/index.js';
202
+ export type { ILogHandler } from './types/index.js';
203
+ //# sourceMappingURL=exports-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exports-module.d.ts","sourceRoot":"","sources":["../src/exports-module.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EACR,QAAQ,EACR,SAAS,EACT,WAAW,EACd,MAAM,kBAAkB,CAAC;AAQ1B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,YAAa,SAAQ,MAAM;IACpC,OAAO,CAAC,gBAAgB,CAAC,CAAmB;IAC5C,OAAO,CAAC,cAAc,CAA0B;gBAEpC,MAAM,GAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,GAAQ;IAUtD;;;;;;;;;;;;;;;OAeG;IACG,UAAU,CACZ,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,EAC9B,OAAO,CAAC,EAAE;QACN,MAAM,CAAC,EAAE;YAAE,KAAK,CAAC,EAAE,QAAQ,CAAC;YAAC,IAAI,CAAC,EAAE,IAAI,CAAC;YAAC,EAAE,CAAC,EAAE,IAAI,CAAA;SAAE,CAAC;QACtD,KAAK,CAAC,EAAE,MAAM,CAAC;KAClB,GACF,OAAO,CAAC,MAAM,CAAC;IASlB;;;;;;;;;;OAUG;IACH,OAAO,IAAI,GAAG,EAAE;IAShB;;;;;;;OAOG;IACH,SAAS,IAAI,IAAI;IAMjB;;;;;;;;;;OAUG;IACH,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IASrC;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAMzD;;;;;;;OAOG;IACH,mBAAmB,IAAI,IAAI;IAa3B;;;;;;;OAOG;IACG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;CAO7C;AAGD,QAAA,MAAM,YAAY,cAAyC,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,WAAW;IACpB;;OAEG;wBACuB,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAI/C;;OAEG;yBACwB,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAIhD;;OAEG;wBACuB,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAI/C;;OAEG;gBACS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAIlC;;OAEG;aACM,IAAI;CAGhB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW;IACpB;;OAEG;qBACc,MAAM,WAAW,MAAM,GAAG,IAAI;IAI/C;;OAEG;sBACe,IAAI;IAItB;;OAEG;aACY,OAAO,CAAC,IAAI,CAAC;CAG/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,GAAG,EAAE,SAAgC,CAAC;AACrE,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,GAAG,EAAE,SAA+B,CAAC;AACnE,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,GAAG,EAAE,SAA+B,CAAC;AACnE,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,GAAG,EAAE,SAAgC,CAAC;AACrE,eAAO,MAAM,OAAO,GAAI,GAAG,MAAM,GAAG,EAAE,SAAkC,CAAC;AACzE,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,GAAG,EAAE,SAAmC,CAAC;AAC3E,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,GAAG,EAAE,SAAgC,CAAC;AACrE,eAAO,MAAM,KAAK,GAAI,MAAM,GAAG,EAAE,UAAU,MAAM,EAAE,SAAsC,CAAC;AAC1F,eAAO,MAAM,KAAK,GAAI,OAAO,MAAM,EAAE,YAAY,OAAO,SAAyC,CAAC;AAClG,eAAO,MAAM,QAAQ,YAAgC,CAAC;AACtD,eAAO,MAAM,IAAI,GAAI,OAAO,MAAM,SAA6B,CAAC;AAChE,eAAO,MAAM,OAAO,GAAI,OAAO,MAAM,SAAgC,CAAC;AACtE,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,SAAyC,CAAC;AACxF,eAAO,MAAM,KAAK,GAAI,QAAQ,MAAM,6CAA+B,CAAC;AACpE,eAAO,MAAM,YAAY,GAAI,OAAO,SAAS,SAAqC,CAAC;AACnF,eAAO,MAAM,UAAU,GAAI,SAAS,WAAW,SAAqC,CAAC;AAErF;;GAEG;AACH,eAAO,MAAM,UAAU,GAAU,QAAQ,KAAK,GAAG,MAAM,GAAG,KAAK,EAAE,UAAU,GAAG,oBAC5B,CAAC;AACnD,eAAO,MAAM,OAAO,aAA+B,CAAC;AACpD,eAAO,MAAM,SAAS,YAAiC,CAAC;AACxD,eAAO,MAAM,WAAW,8BAAmC,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,UAAU,MAAM,EAAE,SAAS,MAAM,SACf,CAAC;AACpD,eAAO,MAAM,mBAAmB,YAA2C,CAAC;AAC5E,eAAO,MAAM,mBAAmB,qBAAuD,CAAC;AAGxF,eAAe,YAAY,CAAC;AAG5B,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGzE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,260 @@
1
+ /**
2
+ * @fileoverview Exports Module - Export and remote logging capabilities
3
+ * @version 0.0.1
4
+ *
5
+ * This module provides export functionality for logs including CSV, JSON, XML formats
6
+ * and remote logging capabilities for sending logs to external services.
7
+ */
8
+ // Core logger and types
9
+ import { Logger } from './Logger.js';
10
+ // Export handlers
11
+ import { ExportLogHandler, RemoteLogHandler } from './handlers/index.js';
12
+ /**
13
+ * Logger with export and remote capabilities
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * import { ExportLogger } from '@mks2508/better-logger/exports';
18
+ *
19
+ * const logger = new ExportLogger({ bufferSize: 1000 });
20
+ *
21
+ * // Log some data
22
+ * logger.info('User logged in', { userId: 123 });
23
+ * logger.error('Failed to process', { error: 'timeout' });
24
+ *
25
+ * // Export logs
26
+ * const csvData = await logger.exportLogs('csv');
27
+ * const jsonData = await logger.exportLogs('json');
28
+ *
29
+ * // Setup remote logging
30
+ * logger.addRemoteHandler('https://api.myapp.com/logs', 'api-key');
31
+ * ```
32
+ */
33
+ export class ExportLogger extends Logger {
34
+ exportLogHandler;
35
+ remoteHandlers = [];
36
+ constructor(config = {}) {
37
+ super(config);
38
+ // Initialize export handler if buffer size specified
39
+ if (config.bufferSize) {
40
+ this.exportLogHandler = new ExportLogHandler(config.bufferSize);
41
+ this.addHandler(this.exportLogHandler);
42
+ }
43
+ }
44
+ /**
45
+ * Export logs in specified format
46
+ *
47
+ * @param format - Export format (csv, json, xml)
48
+ * @param options - Export options
49
+ * @returns Promise resolving to exported data
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * const csvData = await logger.exportLogs('csv');
54
+ * const jsonData = await logger.exportLogs('json', {
55
+ * filter: { level: 'error' },
56
+ * limit: 100
57
+ * });
58
+ * ```
59
+ */
60
+ async exportLogs(format, options) {
61
+ if (!this.exportLogHandler) {
62
+ throw new Error('Export handler not initialized. Set bufferSize in constructor.');
63
+ }
64
+ // Temporary implementation - ExportLogHandler needs these methods
65
+ return JSON.stringify([]);
66
+ }
67
+ /**
68
+ * Get current log buffer
69
+ *
70
+ * @returns Array of log entries
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * const logs = logger.getLogs();
75
+ * console.log(`Buffered ${logs.length} log entries`);
76
+ * ```
77
+ */
78
+ getLogs() {
79
+ if (!this.exportLogHandler) {
80
+ return [];
81
+ }
82
+ // Temporary implementation - ExportLogHandler needs these methods
83
+ return [];
84
+ }
85
+ /**
86
+ * Clear the log buffer
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * logger.clearLogs();
91
+ * ```
92
+ */
93
+ clearLogs() {
94
+ if (this.exportLogHandler) {
95
+ // Temporary implementation - ExportLogHandler needs these methods
96
+ }
97
+ }
98
+ /**
99
+ * Get log statistics
100
+ *
101
+ * @returns Statistics object with counts by level
102
+ *
103
+ * @example
104
+ * ```typescript
105
+ * const stats = logger.getLogStats();
106
+ * console.log(`Errors: ${stats.error}, Warnings: ${stats.warn}`);
107
+ * ```
108
+ */
109
+ getLogStats() {
110
+ if (!this.exportLogHandler) {
111
+ return {};
112
+ }
113
+ // Temporary implementation - ExportLogHandler needs these methods
114
+ return {};
115
+ }
116
+ /**
117
+ * Add remote logging handler
118
+ *
119
+ * @param endpoint - Remote endpoint URL
120
+ * @param apiKey - Optional API key for authentication
121
+ *
122
+ * @example
123
+ * ```typescript
124
+ * logger.addRemoteHandler('https://logs.myservice.com/api', 'secret-key');
125
+ * ```
126
+ */
127
+ addRemoteHandler(endpoint, apiKey) {
128
+ const remoteHandler = new RemoteLogHandler(endpoint, apiKey);
129
+ this.remoteHandlers.push(remoteHandler);
130
+ this.addHandler(remoteHandler);
131
+ }
132
+ /**
133
+ * Remove all remote handlers
134
+ *
135
+ * @example
136
+ * ```typescript
137
+ * logger.clearRemoteHandlers();
138
+ * ```
139
+ */
140
+ clearRemoteHandlers() {
141
+ // Remove from handlers array
142
+ const allHandlers = this.getHandlers();
143
+ this.remoteHandlers.forEach(remoteHandler => {
144
+ const index = allHandlers.indexOf(remoteHandler);
145
+ if (index > -1) {
146
+ allHandlers.splice(index, 1);
147
+ }
148
+ });
149
+ this.remoteHandlers = [];
150
+ }
151
+ /**
152
+ * Flush all remote handlers (force send pending logs)
153
+ *
154
+ * @example
155
+ * ```typescript
156
+ * await logger.flushRemoteHandlers();
157
+ * ```
158
+ */
159
+ async flushRemoteHandlers() {
160
+ const flushPromises = this.remoteHandlers.map(handler => Promise.resolve() // RemoteLogHandler needs flush method
161
+ );
162
+ await Promise.all(flushPromises);
163
+ }
164
+ }
165
+ // Create singleton instance with export capabilities
166
+ const exportLogger = new ExportLogger({ bufferSize: 1000 });
167
+ /**
168
+ * Export management utilities
169
+ */
170
+ export const exportUtils = {
171
+ /**
172
+ * Export current logs as CSV
173
+ */
174
+ async exportCSV(options) {
175
+ return await exportLogger.exportLogs('csv', options);
176
+ },
177
+ /**
178
+ * Export current logs as JSON
179
+ */
180
+ async exportJSON(options) {
181
+ return await exportLogger.exportLogs('json', options);
182
+ },
183
+ /**
184
+ * Export current logs as XML
185
+ */
186
+ async exportXML(options) {
187
+ return await exportLogger.exportLogs('xml', options);
188
+ },
189
+ /**
190
+ * Get log statistics
191
+ */
192
+ getStats() {
193
+ return exportLogger.getLogStats();
194
+ },
195
+ /**
196
+ * Clear all logs
197
+ */
198
+ clear() {
199
+ exportLogger.clearLogs();
200
+ }
201
+ };
202
+ /**
203
+ * Remote logging utilities
204
+ */
205
+ export const remoteUtils = {
206
+ /**
207
+ * Add remote logging endpoint
208
+ */
209
+ addEndpoint(url, apiKey) {
210
+ exportLogger.addRemoteHandler(url, apiKey);
211
+ },
212
+ /**
213
+ * Clear all remote endpoints
214
+ */
215
+ clearEndpoints() {
216
+ exportLogger.clearRemoteHandlers();
217
+ },
218
+ /**
219
+ * Flush all remote logs
220
+ */
221
+ async flush() {
222
+ await exportLogger.flushRemoteHandlers();
223
+ }
224
+ };
225
+ /**
226
+ * Export individual logging methods with export capabilities
227
+ */
228
+ export const debug = (...args) => exportLogger.debug(...args);
229
+ export const info = (...args) => exportLogger.info(...args);
230
+ export const warn = (...args) => exportLogger.warn(...args);
231
+ export const error = (...args) => exportLogger.error(...args);
232
+ export const success = (...args) => exportLogger.success(...args);
233
+ export const critical = (...args) => exportLogger.critical(...args);
234
+ export const trace = (...args) => exportLogger.trace(...args);
235
+ export const table = (data, columns) => exportLogger.table(data, columns);
236
+ export const group = (label, collapsed) => exportLogger.group(label, collapsed);
237
+ export const groupEnd = () => exportLogger.groupEnd();
238
+ export const time = (label) => exportLogger.time(label);
239
+ export const timeEnd = (label) => exportLogger.timeEnd(label);
240
+ export const setGlobalPrefix = (prefix) => exportLogger.setGlobalPrefix(prefix);
241
+ export const scope = (prefix) => exportLogger.scope(prefix);
242
+ export const setVerbosity = (level) => exportLogger.setVerbosity(level);
243
+ export const addHandler = (handler) => exportLogger.addHandler(handler);
244
+ /**
245
+ * Export functionality
246
+ */
247
+ export const exportLogs = async (format, options) => await exportLogger.exportLogs(format, options);
248
+ export const getLogs = () => exportLogger.getLogs();
249
+ export const clearLogs = () => exportLogger.clearLogs();
250
+ export const getLogStats = () => exportLogger.getLogStats();
251
+ /**
252
+ * Remote logging functionality
253
+ */
254
+ export const addRemoteHandler = (endpoint, apiKey) => exportLogger.addRemoteHandler(endpoint, apiKey);
255
+ export const clearRemoteHandlers = () => exportLogger.clearRemoteHandlers();
256
+ export const flushRemoteHandlers = async () => await exportLogger.flushRemoteHandlers();
257
+ // Export the singleton as default
258
+ export default exportLogger;
259
+ // Re-export handlers
260
+ export { ExportLogHandler, RemoteLogHandler } from './handlers/index.js';
package/dist/exports.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./chunks/Logger-BQhMKy_T.js"),r=require("./chunks/exports-U1xLBXrY.js");class ExportLogger extends e.Logger{exportLogHandler;remoteHandlers=[];constructor(e={}){super(e),e.bufferSize&&(this.exportLogHandler=new r.ExportLogHandler(e.bufferSize),this.addHandler(this.exportLogHandler))}async exportLogs(e,r){if(!this.exportLogHandler)throw new Error("Export handler not initialized. Set bufferSize in constructor.");return JSON.stringify([])}getLogs(){return this.exportLogHandler,[]}clearLogs(){this.exportLogHandler}getLogStats(){return this.exportLogHandler,{}}addRemoteHandler(e,t){const o=new r.RemoteLogHandler(e,t);this.remoteHandlers.push(o),this.addHandler(o)}clearRemoteHandlers(){const e=this.getHandlers();this.remoteHandlers.forEach(r=>{const t=e.indexOf(r);t>-1&&e.splice(t,1)}),this.remoteHandlers=[]}async flushRemoteHandlers(){const e=this.remoteHandlers.map(e=>Promise.resolve());await Promise.all(e)}}const t=new ExportLogger({bufferSize:1e3}),o={exportCSV:async e=>await t.exportLogs("csv",e),exportJSON:async e=>await t.exportLogs("json",e),exportXML:async e=>await t.exportLogs("xml",e),getStats:()=>t.getLogStats(),clear(){t.clearLogs()}},s={addEndpoint(e,r){t.addRemoteHandler(e,r)},clearEndpoints(){t.clearRemoteHandlers()},async flush(){await t.flushRemoteHandlers()}};exports.ExportLogHandler=r.ExportLogHandler,exports.RemoteLogHandler=r.RemoteLogHandler,exports.ExportLogger=ExportLogger,exports.addHandler=e=>t.addHandler(e),exports.addRemoteHandler=(e,r)=>t.addRemoteHandler(e,r),exports.clearLogs=()=>t.clearLogs(),exports.clearRemoteHandlers=()=>t.clearRemoteHandlers(),exports.createScopedLogger=e=>t.createScopedLogger(e),exports.critical=(...e)=>t.critical(...e),exports.debug=(...e)=>t.debug(...e),exports.default=t,exports.error=(...e)=>t.error(...e),exports.exportLogs=async(e,r)=>await t.exportLogs(e,r),exports.exportUtils=o,exports.flushRemoteHandlers=async()=>await t.flushRemoteHandlers(),exports.getLogStats=()=>t.getLogStats(),exports.getLogs=()=>t.getLogs(),exports.group=(e,r)=>t.group(e,r),exports.groupEnd=()=>t.groupEnd(),exports.info=(...e)=>t.info(...e),exports.remoteUtils=s,exports.setGlobalPrefix=e=>t.setGlobalPrefix(e),exports.setVerbosity=e=>t.setVerbosity(e),exports.success=(...e)=>t.success(...e),exports.table=(e,r)=>t.table(e,r),exports.time=e=>t.time(e),exports.timeEnd=e=>t.timeEnd(e),exports.trace=(...e)=>t.trace(...e),exports.warn=(...e)=>t.warn(...e);
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./chunks/Logger-BpeuYIxR.js");require("./chunks/environment-Dm66zOML.js");const r=require("./chunks/RemoteLogHandler-ymkQ97xl.js");class ExportLogger extends e.Logger{exportLogHandler;remoteHandlers=[];constructor(r={}){super(r),r.bufferSize&&(this.exportLogHandler=new e.ExportLogHandler(r.bufferSize),this.addHandler(this.exportLogHandler))}async exportLogs(e,r){if(!this.exportLogHandler)throw new Error("Export handler not initialized. Set bufferSize in constructor.");return JSON.stringify([])}getLogs(){return this.exportLogHandler,[]}clearLogs(){this.exportLogHandler}getLogStats(){return this.exportLogHandler,{}}addRemoteHandler(e,t){const o=new r.RemoteLogHandler(e,t);this.remoteHandlers.push(o),this.addHandler(o)}clearRemoteHandlers(){const e=this.getHandlers();this.remoteHandlers.forEach(r=>{const t=e.indexOf(r);t>-1&&e.splice(t,1)}),this.remoteHandlers=[]}async flushRemoteHandlers(){const e=this.remoteHandlers.map(e=>Promise.resolve());await Promise.all(e)}}const t=new ExportLogger({bufferSize:1e3}),o={exportCSV:async e=>await t.exportLogs("csv",e),exportJSON:async e=>await t.exportLogs("json",e),exportXML:async e=>await t.exportLogs("xml",e),getStats:()=>t.getLogStats(),clear(){t.clearLogs()}},s={addEndpoint(e,r){t.addRemoteHandler(e,r)},clearEndpoints(){t.clearRemoteHandlers()},async flush(){await t.flushRemoteHandlers()}};exports.ExportLogHandler=e.ExportLogHandler,exports.RemoteLogHandler=r.RemoteLogHandler,exports.ExportLogger=ExportLogger,exports.addHandler=e=>t.addHandler(e),exports.addRemoteHandler=(e,r)=>t.addRemoteHandler(e,r),exports.clearLogs=()=>t.clearLogs(),exports.clearRemoteHandlers=()=>t.clearRemoteHandlers(),exports.critical=(...e)=>t.critical(...e),exports.debug=(...e)=>t.debug(...e),exports.default=t,exports.error=(...e)=>t.error(...e),exports.exportLogs=async(e,r)=>await t.exportLogs(e,r),exports.exportUtils=o,exports.flushRemoteHandlers=async()=>await t.flushRemoteHandlers(),exports.getLogStats=()=>t.getLogStats(),exports.getLogs=()=>t.getLogs(),exports.group=(e,r)=>t.group(e,r),exports.groupEnd=()=>t.groupEnd(),exports.info=(...e)=>t.info(...e),exports.remoteUtils=s,exports.scope=e=>t.scope(e),exports.setGlobalPrefix=e=>t.setGlobalPrefix(e),exports.setVerbosity=e=>t.setVerbosity(e),exports.success=(...e)=>t.success(...e),exports.table=(e,r)=>t.table(e,r),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=exports.cjs.map