@mks2508/better-logger 0.0.2-alpha.2 โ†’ 0.11.0-alpha.1

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 (247) hide show
  1. package/.github/workflows/ci-quality.yml +357 -0
  2. package/.github/workflows/docs-demo.yml +119 -0
  3. package/.github/workflows/releases-core.yml +512 -0
  4. package/.github/workflows/releases-full.yml +582 -0
  5. package/.github/{workflows โ†’ workflows-backup}/ci.yml +12 -110
  6. package/.github/workflows-backup/nightly.yml +196 -0
  7. package/.github/workflows-backup/release-optimized.yml +373 -0
  8. package/.release-notes-0.2.0.md +129 -0
  9. package/.yamllint +28 -0
  10. package/CHANGELOG.json +749 -0
  11. package/CLAUDE.md +92 -1
  12. package/README.md +142 -498
  13. package/bun.lock +323 -0
  14. package/demo.html +9 -2
  15. package/dist/Logger.d.ts +176 -0
  16. package/dist/Logger.d.ts.map +1 -0
  17. package/dist/Logger.js +498 -0
  18. package/dist/chunks/Logger-C2-cR3No.js +2 -0
  19. package/dist/chunks/Logger-C2-cR3No.js.map +1 -0
  20. package/dist/chunks/Logger-CVwk8cgA.js +2159 -0
  21. package/dist/chunks/Logger-CVwk8cgA.js.map +1 -0
  22. package/dist/chunks/RemoteLogHandler-CjWpWZGl.js +33 -0
  23. package/dist/chunks/RemoteLogHandler-CjWpWZGl.js.map +1 -0
  24. package/dist/chunks/RemoteLogHandler-ymkQ97xl.js +2 -0
  25. package/dist/chunks/RemoteLogHandler-ymkQ97xl.js.map +1 -0
  26. package/dist/chunks/StyleBuilder-BoJTmskd.js +361 -0
  27. package/dist/chunks/StyleBuilder-BoJTmskd.js.map +1 -0
  28. package/dist/chunks/StyleBuilder-LPLzsoHY.js +4 -0
  29. package/dist/chunks/StyleBuilder-LPLzsoHY.js.map +1 -0
  30. package/dist/cli/CommandProcessor.d.ts +103 -0
  31. package/dist/cli/CommandProcessor.d.ts.map +1 -0
  32. package/dist/cli/CommandProcessor.js +184 -0
  33. package/dist/cli/commands/ConfigCommand.d.ts +17 -0
  34. package/dist/cli/commands/ConfigCommand.d.ts.map +1 -0
  35. package/dist/cli/commands/ConfigCommand.js +88 -0
  36. package/dist/cli/commands/ExportCommand.d.ts +51 -0
  37. package/dist/cli/commands/ExportCommand.d.ts.map +1 -0
  38. package/dist/cli/commands/ExportCommand.js +243 -0
  39. package/dist/cli/commands/HistoryCommand.d.ts +50 -0
  40. package/dist/cli/commands/HistoryCommand.d.ts.map +1 -0
  41. package/dist/cli/commands/HistoryCommand.js +96 -0
  42. package/dist/cli/commands/StatusCommand.d.ts +33 -0
  43. package/dist/cli/commands/StatusCommand.d.ts.map +1 -0
  44. package/dist/cli/commands/StatusCommand.js +93 -0
  45. package/dist/cli/commands/ThemeCommand.d.ts +33 -0
  46. package/dist/cli/commands/ThemeCommand.d.ts.map +1 -0
  47. package/dist/cli/commands/ThemeCommand.js +79 -0
  48. package/dist/cli/help.d.ts +15 -0
  49. package/dist/cli/help.d.ts.map +1 -0
  50. package/dist/cli/help.js +118 -0
  51. package/dist/cli/index.d.ts +15 -0
  52. package/dist/cli/index.d.ts.map +1 -0
  53. package/dist/cli/index.js +46 -0
  54. package/dist/constants.d.ts +91 -0
  55. package/dist/constants.d.ts.map +1 -0
  56. package/dist/constants.js +80 -0
  57. package/dist/core.cjs +1 -1
  58. package/dist/core.cjs.map +1 -1
  59. package/dist/core.d.ts +130 -0
  60. package/dist/core.d.ts.map +1 -0
  61. package/dist/core.js +258 -242
  62. package/dist/core.js.map +1 -1
  63. package/dist/example.d.ts +18 -0
  64. package/dist/example.d.ts.map +1 -0
  65. package/dist/example.js +154 -0
  66. package/dist/exports-module.d.ts +203 -0
  67. package/dist/exports-module.d.ts.map +1 -0
  68. package/dist/exports-module.js +260 -0
  69. package/dist/exports.cjs +1 -1
  70. package/dist/exports.cjs.map +1 -1
  71. package/dist/exports.js +2 -2
  72. package/dist/handlers/AnalyticsLogHandler.d.ts +11 -0
  73. package/dist/handlers/AnalyticsLogHandler.d.ts.map +1 -0
  74. package/dist/handlers/AnalyticsLogHandler.js +19 -0
  75. package/dist/handlers/ExportLogHandler.d.ts +103 -0
  76. package/dist/handlers/ExportLogHandler.d.ts.map +1 -0
  77. package/dist/handlers/ExportLogHandler.js +516 -0
  78. package/dist/handlers/FileLogHandler.d.ts +13 -0
  79. package/dist/handlers/FileLogHandler.d.ts.map +1 -0
  80. package/dist/handlers/FileLogHandler.js +24 -0
  81. package/dist/handlers/RemoteLogHandler.d.ts +14 -0
  82. package/dist/handlers/RemoteLogHandler.d.ts.map +1 -0
  83. package/dist/handlers/RemoteLogHandler.js +37 -0
  84. package/dist/handlers/index.d.ts +8 -0
  85. package/dist/handlers/index.d.ts.map +1 -0
  86. package/dist/handlers/index.js +7 -0
  87. package/dist/index.cjs +1 -1
  88. package/dist/index.cjs.map +1 -1
  89. package/dist/index.d.ts +86 -0
  90. package/dist/index.d.ts.map +1 -0
  91. package/dist/index.js +89 -103
  92. package/dist/main.d.ts +2 -0
  93. package/dist/main.d.ts.map +1 -0
  94. package/dist/main.js +139 -0
  95. package/dist/styling/StyleBuilder.d.ts +132 -0
  96. package/dist/styling/StyleBuilder.d.ts.map +1 -0
  97. package/dist/styling/StyleBuilder.js +268 -0
  98. package/dist/styling/banners.d.ts +45 -0
  99. package/dist/styling/banners.d.ts.map +1 -0
  100. package/dist/styling/banners.js +155 -0
  101. package/dist/styling/index.d.ts +7 -0
  102. package/dist/styling/index.d.ts.map +1 -0
  103. package/dist/styling/index.js +6 -0
  104. package/dist/styling/themes.d.ts +10 -0
  105. package/dist/styling/themes.d.ts.map +1 -0
  106. package/dist/styling/themes.js +231 -0
  107. package/dist/styling-module.d.ts +185 -0
  108. package/dist/styling-module.d.ts.map +1 -0
  109. package/dist/styling-module.js +199 -0
  110. package/dist/styling.cjs +1 -1
  111. package/dist/styling.cjs.map +1 -1
  112. package/dist/styling.js +4 -4
  113. package/dist/types/Logger.d.ts +172 -0
  114. package/dist/types/Logger.d.ts.map +1 -0
  115. package/dist/types/cli/CommandProcessor.d.ts +100 -0
  116. package/dist/types/cli/CommandProcessor.d.ts.map +1 -0
  117. package/dist/types/cli/commands/ConfigCommand.d.ts +14 -0
  118. package/dist/types/cli/commands/ConfigCommand.d.ts.map +1 -0
  119. package/dist/types/cli/commands/ExportCommand.d.ts +48 -0
  120. package/dist/types/cli/commands/ExportCommand.d.ts.map +1 -0
  121. package/dist/types/cli/commands/HistoryCommand.d.ts +47 -0
  122. package/dist/types/cli/commands/HistoryCommand.d.ts.map +1 -0
  123. package/dist/types/cli/commands/StatusCommand.d.ts +30 -0
  124. package/dist/types/cli/commands/StatusCommand.d.ts.map +1 -0
  125. package/dist/types/cli/commands/ThemeCommand.d.ts +30 -0
  126. package/dist/types/cli/commands/ThemeCommand.d.ts.map +1 -0
  127. package/dist/types/cli/help.d.ts +12 -0
  128. package/dist/types/cli/help.d.ts.map +1 -0
  129. package/dist/types/cli/index.d.ts +15 -0
  130. package/dist/types/cli/index.d.ts.map +1 -0
  131. package/dist/types/constants.d.ts +88 -0
  132. package/dist/types/constants.d.ts.map +1 -0
  133. package/dist/types/core.d.ts +71 -211
  134. package/dist/types/core.d.ts.map +1 -0
  135. package/dist/types/core.js +13 -0
  136. package/dist/types/example.d.ts +18 -0
  137. package/dist/types/example.d.ts.map +1 -0
  138. package/dist/types/exports-module.d.ts +196 -0
  139. package/dist/types/exports-module.d.ts.map +1 -0
  140. package/dist/types/handlers/AnalyticsLogHandler.d.ts +8 -0
  141. package/dist/types/handlers/AnalyticsLogHandler.d.ts.map +1 -0
  142. package/dist/types/handlers/ExportLogHandler.d.ts +100 -0
  143. package/dist/types/handlers/ExportLogHandler.d.ts.map +1 -0
  144. package/dist/types/handlers/FileLogHandler.d.ts +10 -0
  145. package/dist/types/handlers/FileLogHandler.d.ts.map +1 -0
  146. package/dist/types/handlers/RemoteLogHandler.d.ts +11 -0
  147. package/dist/types/handlers/RemoteLogHandler.d.ts.map +1 -0
  148. package/dist/types/handlers/index.d.ts +8 -0
  149. package/dist/types/handlers/index.d.ts.map +1 -0
  150. package/dist/types/handlers.d.ts +88 -0
  151. package/dist/types/handlers.d.ts.map +1 -0
  152. package/dist/types/handlers.js +4 -0
  153. package/dist/types/index.d.ts +7 -675
  154. package/dist/types/index.d.ts.map +1 -0
  155. package/dist/types/index.js +4 -0
  156. package/dist/types/main.d.ts +2 -0
  157. package/dist/types/main.d.ts.map +1 -0
  158. package/dist/types/styling/StyleBuilder.d.ts +132 -0
  159. package/dist/types/styling/StyleBuilder.d.ts.map +1 -0
  160. package/dist/types/styling/banners.d.ts +42 -0
  161. package/dist/types/styling/banners.d.ts.map +1 -0
  162. package/dist/types/styling/index.d.ts +7 -0
  163. package/dist/types/styling/index.d.ts.map +1 -0
  164. package/dist/types/styling/themes.d.ts +7 -0
  165. package/dist/types/styling/themes.d.ts.map +1 -0
  166. package/dist/types/styling-module.d.ts +178 -0
  167. package/dist/types/styling-module.d.ts.map +1 -0
  168. package/dist/types/types/core.d.ts +71 -0
  169. package/dist/types/types/core.d.ts.map +1 -0
  170. package/dist/types/types/handlers.d.ts +85 -0
  171. package/dist/types/types/handlers.d.ts.map +1 -0
  172. package/dist/types/types/index.d.ts +7 -0
  173. package/dist/types/types/index.d.ts.map +1 -0
  174. package/dist/types/utils/index.d.ts +7 -0
  175. package/dist/types/utils/index.d.ts.map +1 -0
  176. package/dist/types/utils/output.d.ts +29 -0
  177. package/dist/types/utils/output.d.ts.map +1 -0
  178. package/dist/types/utils/stackTrace.d.ts +6 -0
  179. package/dist/types/utils/stackTrace.d.ts.map +1 -0
  180. package/dist/types/utils/timestamps.d.ts +20 -0
  181. package/dist/types/utils/timestamps.d.ts.map +1 -0
  182. package/dist/utils/index.d.ts +7 -0
  183. package/dist/utils/index.d.ts.map +1 -0
  184. package/dist/utils/index.js +6 -0
  185. package/dist/utils/output.d.ts +32 -0
  186. package/dist/utils/output.d.ts.map +1 -0
  187. package/dist/utils/output.js +97 -0
  188. package/dist/utils/stackTrace.d.ts +9 -0
  189. package/dist/utils/stackTrace.d.ts.map +1 -0
  190. package/dist/utils/stackTrace.js +81 -0
  191. package/dist/utils/timestamps.d.ts +20 -0
  192. package/dist/utils/timestamps.d.ts.map +1 -0
  193. package/dist/utils/timestamps.js +71 -0
  194. package/docs/API.md +691 -0
  195. package/docs/DEVELOPMENT.md +731 -0
  196. package/docs/PACKAGES.md +244 -0
  197. package/docs/_config.yml +36 -0
  198. package/docs/index.md +179 -0
  199. package/examples/README.md +208 -0
  200. package/examples/basic-logging.js +75 -0
  201. package/examples/data-export.js +234 -0
  202. package/examples/package.json +16 -0
  203. package/examples/performance-timing.js +170 -0
  204. package/examples/styling-themes.js +207 -0
  205. package/package.json +32 -21
  206. package/packages/core/package.json +35 -0
  207. package/packages/exports/package.json +41 -0
  208. package/packages/styling/package.json +41 -0
  209. package/project-utils/README.md +172 -0
  210. package/project-utils/auto-release-gemini.ts +1193 -0
  211. package/project-utils/commit-generator.ts +1385 -0
  212. package/project-utils/commit-ui.ts +264 -0
  213. package/project-utils/git-utils.ts +199 -0
  214. package/project-utils/github-release-manager.ts +466 -0
  215. package/project-utils/prompt-templates.js +345 -0
  216. package/project-utils/prompt-templates.ts +422 -0
  217. package/project-utils/version-manager.ts +1078 -0
  218. package/src/Logger.ts +2 -1
  219. package/src/cli/CommandProcessor.ts +173 -2
  220. package/src/cli/commands/HistoryCommand.ts +117 -0
  221. package/src/cli/index.ts +12 -0
  222. package/src/handlers/ExportLogHandler.ts +141 -0
  223. package/tests/test-conflict-resolution.ts +391 -0
  224. package/tests/validate-workflows.sh +131 -0
  225. package/tests/yaml-autofix.sh +146 -0
  226. package/vite.config.ts +152 -50
  227. package/.claude/settings.local.json +0 -22
  228. package/.npmrc.bak +0 -1
  229. package/dist/chunks/Logger-BQhMKy_T.js +0 -2
  230. package/dist/chunks/Logger-BQhMKy_T.js.map +0 -1
  231. package/dist/chunks/Logger-BrFKFZcD.js +0 -978
  232. package/dist/chunks/Logger-BrFKFZcD.js.map +0 -1
  233. package/dist/chunks/core-2opW4Pi3.js +0 -194
  234. package/dist/chunks/core-2opW4Pi3.js.map +0 -1
  235. package/dist/chunks/core-DyugwSYZ.js +0 -4
  236. package/dist/chunks/core-DyugwSYZ.js.map +0 -1
  237. package/dist/chunks/exports-BNP3R7dp.js +0 -421
  238. package/dist/chunks/exports-BNP3R7dp.js.map +0 -1
  239. package/dist/chunks/exports-U1xLBXrY.js +0 -2
  240. package/dist/chunks/exports-U1xLBXrY.js.map +0 -1
  241. package/dist/chunks/styling-DhUDzwlE.js +0 -654
  242. package/dist/chunks/styling-DhUDzwlE.js.map +0 -1
  243. package/dist/chunks/styling-tmRDI28D.js +0 -2
  244. package/dist/chunks/styling-tmRDI28D.js.map +0 -1
  245. package/dist/types/exports.d.ts +0 -600
  246. package/dist/types/styling.d.ts +0 -751
  247. /package/.github/{workflows โ†’ workflows-backup}/release.yml +0 -0
package/dist/Logger.js ADDED
@@ -0,0 +1,498 @@
1
+ /**
2
+ * @fileoverview Refactored Advanced Logger with modular architecture
3
+ * @version 2.0.0
4
+ */
5
+ // Utility imports
6
+ import { parseStackTrace, formatTimestamp, createStyledOutput } from './utils/index.js';
7
+ // Styling imports
8
+ import { THEME_PRESETS, THEME_BANNERS, displayInitBanner, StylePresets, StyleBuilder } from './styling/index.js';
9
+ // Handler imports
10
+ import { ExportLogHandler } from './handlers/index.js';
11
+ // CLI imports
12
+ import { createDefaultCLI } from './cli/index.js';
13
+ // Constants
14
+ import { DEFAULT_CONFIG } from './constants.js';
15
+ /**
16
+ * Current active theme styles
17
+ */
18
+ let LEVEL_STYLES = THEME_PRESETS.default;
19
+ /**
20
+ * Main Logger class implementing state-of-the-art logging capabilities
21
+ */
22
+ export class Logger {
23
+ config;
24
+ scopedPrefix;
25
+ handlers = [];
26
+ timers = new Map();
27
+ groupDepth = 0;
28
+ exportHandler;
29
+ cliProcessor;
30
+ /**
31
+ * Creates a new Logger instance
32
+ */
33
+ constructor(config = {}) {
34
+ this.config = {
35
+ ...DEFAULT_CONFIG,
36
+ ...config,
37
+ };
38
+ // Initialize export handler if buffer size is specified
39
+ if (this.config.bufferSize) {
40
+ this.exportHandler = new ExportLogHandler(this.config.bufferSize);
41
+ this.handlers.push(this.exportHandler);
42
+ }
43
+ // Initialize CLI processor
44
+ this.cliProcessor = createDefaultCLI();
45
+ }
46
+ // ===== CONFIGURATION METHODS =====
47
+ /**
48
+ * Get current configuration
49
+ */
50
+ getConfig() {
51
+ return { ...this.config };
52
+ }
53
+ /**
54
+ * Update configuration
55
+ */
56
+ updateConfig(updates) {
57
+ this.config = { ...this.config, ...updates };
58
+ }
59
+ /**
60
+ * Sets the global prefix for all log messages
61
+ */
62
+ setGlobalPrefix(prefix) {
63
+ this.config.globalPrefix = prefix;
64
+ }
65
+ /**
66
+ * Sets the verbosity level for filtering log output
67
+ */
68
+ setVerbosity(level) {
69
+ this.config.verbosity = level;
70
+ }
71
+ /**
72
+ * Sets the logger theme
73
+ */
74
+ setTheme(theme) {
75
+ if (theme in THEME_PRESETS) {
76
+ LEVEL_STYLES = THEME_PRESETS[theme];
77
+ this.config.theme = theme;
78
+ // Show theme-specific banner
79
+ if (theme in THEME_BANNERS) {
80
+ const themeBanner = THEME_BANNERS[theme];
81
+ console.log(`%c${themeBanner.simple}`, themeBanner.style);
82
+ }
83
+ this.success(`Theme changed to: ${theme}`);
84
+ }
85
+ else {
86
+ this.error(`Invalid theme: ${theme}. Available themes:`, Object.keys(THEME_PRESETS));
87
+ }
88
+ }
89
+ /**
90
+ * Set banner type for initialization display
91
+ */
92
+ setBannerType(bannerType) {
93
+ this.config.bannerType = bannerType;
94
+ this.success(`Banner type changed to: ${bannerType}`);
95
+ }
96
+ /**
97
+ * Reset logger to default configuration
98
+ */
99
+ resetConfig() {
100
+ this.config = { ...DEFAULT_CONFIG };
101
+ LEVEL_STYLES = THEME_PRESETS.default;
102
+ this.success('Logger configuration reset to defaults');
103
+ }
104
+ // ===== SCOPED LOGGER =====
105
+ /**
106
+ * Creates a scoped logger with a specific prefix
107
+ */
108
+ createScopedLogger(prefix) {
109
+ const scopedLogger = new Logger(this.config);
110
+ scopedLogger.scopedPrefix = prefix;
111
+ scopedLogger.handlers = [...this.handlers];
112
+ scopedLogger.exportHandler = this.exportHandler;
113
+ return scopedLogger;
114
+ }
115
+ // ===== HANDLER MANAGEMENT =====
116
+ /**
117
+ * Adds a custom log handler for extensibility
118
+ */
119
+ addHandler(handler) {
120
+ this.handlers.push(handler);
121
+ }
122
+ /**
123
+ * Get all registered handlers
124
+ */
125
+ getHandlers() {
126
+ return [...this.handlers];
127
+ }
128
+ /**
129
+ * Get export handler if available
130
+ */
131
+ getExportHandler() {
132
+ return this.exportHandler;
133
+ }
134
+ // ===== CORE LOGGING METHODS =====
135
+ /**
136
+ * Checks if a log level should be output based on current verbosity
137
+ */
138
+ shouldLog(level) {
139
+ if (this.config.verbosity === 'silent')
140
+ return false;
141
+ const levels = { debug: 0, info: 1, warn: 2, error: 3, critical: 4 };
142
+ return levels[level] >= levels[this.config.verbosity];
143
+ }
144
+ /**
145
+ * Gets the effective prefix (global + scoped)
146
+ */
147
+ getEffectivePrefix() {
148
+ const parts = [this.config.globalPrefix, this.scopedPrefix].filter(Boolean);
149
+ return parts.length > 0 ? parts.join(':') : undefined;
150
+ }
151
+ /**
152
+ * Core logging method that handles styling and formatting
153
+ */
154
+ log(level, ...args) {
155
+ if (!this.shouldLog(level))
156
+ return;
157
+ const stackInfo = this.config.enableStackTrace ? parseStackTrace() : null;
158
+ const prefix = this.getEffectivePrefix();
159
+ const message = args.length > 0 ? String(args[0]) : '';
160
+ const additionalArgs = args.slice(1);
161
+ // Create styled output
162
+ const [format, ...styles] = createStyledOutput(level, LEVEL_STYLES, prefix, message, stackInfo);
163
+ // Add group indentation
164
+ const groupIndent = ' '.repeat(this.groupDepth);
165
+ const finalFormat = groupIndent + format;
166
+ // Output to console
167
+ if (additionalArgs.length > 0) {
168
+ console.log(finalFormat, ...styles, ...additionalArgs);
169
+ }
170
+ else {
171
+ console.log(finalFormat, ...styles);
172
+ }
173
+ // Update export handler group info
174
+ if (this.exportHandler) {
175
+ this.exportHandler.setGroupInfo(this.groupDepth);
176
+ }
177
+ // Call custom handlers
178
+ const metadata = {
179
+ timestamp: formatTimestamp(),
180
+ level,
181
+ prefix,
182
+ stackInfo: stackInfo ? stackInfo : undefined,
183
+ };
184
+ this.handlers.forEach(handler => {
185
+ try {
186
+ handler.handle(level, message, args, metadata);
187
+ }
188
+ catch (error) {
189
+ console.error('Log handler failed:', error);
190
+ }
191
+ });
192
+ }
193
+ /**
194
+ * Logs debug information (lowest priority)
195
+ */
196
+ debug(...args) {
197
+ this.log('debug', ...args);
198
+ }
199
+ /**
200
+ * Logs informational messages
201
+ */
202
+ info(...args) {
203
+ this.log('info', ...args);
204
+ }
205
+ /**
206
+ * Logs warning messages
207
+ */
208
+ warn(...args) {
209
+ this.log('warn', ...args);
210
+ }
211
+ /**
212
+ * Logs error messages
213
+ */
214
+ error(...args) {
215
+ this.log('error', ...args);
216
+ }
217
+ /**
218
+ * Logs success messages (special info level)
219
+ */
220
+ success(...args) {
221
+ if (!this.shouldLog('info'))
222
+ return;
223
+ const stackInfo = this.config.enableStackTrace ? parseStackTrace() : null;
224
+ const prefix = this.getEffectivePrefix();
225
+ const message = args.length > 0 ? String(args[0]) : '';
226
+ const additionalArgs = args.slice(1);
227
+ // Handle success as special case - use info level with success styling
228
+ const [format, ...styles] = createStyledOutput('info', LEVEL_STYLES, prefix, message, stackInfo);
229
+ // Override with success styling
230
+ const successStyle = LEVEL_STYLES.success;
231
+ let emoji = 'โœ…';
232
+ let label = 'SUCCESS';
233
+ if (successStyle) {
234
+ if (successStyle.emoji) {
235
+ emoji = successStyle.emoji;
236
+ }
237
+ if (successStyle.label) {
238
+ label = successStyle.label;
239
+ }
240
+ }
241
+ const successFormat = format.replace(/โ„น๏ธ INFO/, `${emoji} ${label}`);
242
+ const groupIndent = ' '.repeat(this.groupDepth);
243
+ const finalFormat = groupIndent + successFormat;
244
+ if (additionalArgs.length > 0) {
245
+ console.log(finalFormat, ...styles, ...additionalArgs);
246
+ }
247
+ else {
248
+ console.log(finalFormat, ...styles);
249
+ }
250
+ // Call handlers
251
+ const metadata = {
252
+ timestamp: formatTimestamp(),
253
+ level: 'info',
254
+ prefix,
255
+ stackInfo: stackInfo ? stackInfo : undefined,
256
+ };
257
+ this.handlers.forEach(handler => {
258
+ try {
259
+ handler.handle('info', message, args, metadata);
260
+ }
261
+ catch (error) {
262
+ console.error('Log handler failed:', error);
263
+ }
264
+ });
265
+ }
266
+ /**
267
+ * Logs trace information (detailed debugging)
268
+ */
269
+ trace(...args) {
270
+ this.log('debug', ...args);
271
+ if (this.shouldLog('debug')) {
272
+ console.trace(...args);
273
+ }
274
+ }
275
+ /**
276
+ * Logs critical errors (highest priority)
277
+ */
278
+ critical(...args) {
279
+ this.log('critical', ...args);
280
+ }
281
+ // ===== ADVANCED LOGGING FEATURES =====
282
+ /**
283
+ * Displays data in a table format
284
+ */
285
+ table(data, columns) {
286
+ if (!this.shouldLog('info'))
287
+ return;
288
+ const prefix = this.getEffectivePrefix();
289
+ const tableStyle = StylePresets.accent().build();
290
+ const format = `%c๐Ÿ“Š TABLE${prefix ? ` [${prefix}]` : ''}`;
291
+ console.log(format, tableStyle);
292
+ if (columns) {
293
+ console.table(data, columns);
294
+ }
295
+ else {
296
+ console.table(data);
297
+ }
298
+ }
299
+ /**
300
+ * Starts a collapsible group in the console
301
+ */
302
+ group(label, collapsed = false) {
303
+ const groupStyle = new StyleBuilder()
304
+ .bg('linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%)')
305
+ .color('#1565c0')
306
+ .border('1px solid #90caf9')
307
+ .padding('4px 12px')
308
+ .rounded('6px')
309
+ .bold()
310
+ .build();
311
+ const format = `%c๐Ÿ“ ${label}`;
312
+ if (collapsed) {
313
+ console.groupCollapsed(format, groupStyle);
314
+ }
315
+ else {
316
+ console.group(format, groupStyle);
317
+ }
318
+ this.groupDepth++;
319
+ }
320
+ /**
321
+ * Ends the current console group
322
+ */
323
+ groupEnd() {
324
+ if (this.groupDepth > 0) {
325
+ console.groupEnd();
326
+ this.groupDepth--;
327
+ }
328
+ }
329
+ // ===== PERFORMANCE TIMING =====
330
+ /**
331
+ * Starts a timer with the given label
332
+ */
333
+ time(label) {
334
+ const timer = {
335
+ label,
336
+ startTime: performance.now(),
337
+ };
338
+ this.timers.set(label, timer);
339
+ const timerStyle = StylePresets.warning().build();
340
+ console.log(`%cโฑ๏ธ Timer started: ${label}`, timerStyle);
341
+ }
342
+ /**
343
+ * Ends a timer and logs the elapsed time
344
+ */
345
+ timeEnd(label) {
346
+ const timer = this.timers.get(label);
347
+ if (!timer) {
348
+ this.warn(`Timer '${label}' does not exist`);
349
+ return;
350
+ }
351
+ const elapsed = performance.now() - timer.startTime;
352
+ this.timers.delete(label);
353
+ const timerStyle = StylePresets.success().build();
354
+ console.log(`%cโฑ๏ธ Timer ended: ${label} - ${elapsed.toFixed(2)}ms`, timerStyle);
355
+ }
356
+ // ===== ADVANCED VISUAL FEATURES =====
357
+ /**
358
+ * Display banner with specified or configured type
359
+ */
360
+ showBanner(bannerType) {
361
+ const effectiveBannerType = bannerType ? bannerType : this.config.bannerType;
362
+ displayInitBanner(effectiveBannerType);
363
+ }
364
+ /**
365
+ * Log with SVG background image
366
+ */
367
+ logWithSVG(message, svgContent, options = {}) {
368
+ const { width = 300, height = 60, padding = '30px 150px' } = options;
369
+ let svgDataUri = '';
370
+ if (svgContent) {
371
+ const encodedSVG = encodeURIComponent(svgContent);
372
+ svgDataUri = `data:image/svg+xml,${encodedSVG}`;
373
+ }
374
+ else {
375
+ const defaultSVG = `<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 ${width} ${height}'><defs><linearGradient id='grad' x1='0%' y1='0%' x2='100%' y2='0%'><stop offset='0%' style='stop-color:%23667eea'/><stop offset='100%' style='stop-color:%23764ba2'/></linearGradient></defs><rect width='100%' height='100%' fill='url(%23grad)' rx='4'/><text x='${width / 2}' y='${height / 2 + 5}' text-anchor='middle' fill='white' font-family='monospace' font-size='14' font-weight='bold'>${message}</text></svg>`;
376
+ svgDataUri = `data:image/svg+xml,${encodeURIComponent(defaultSVG)}`;
377
+ }
378
+ const svgStyle = new StyleBuilder()
379
+ .bg(`url("${svgDataUri}") no-repeat center center`)
380
+ .padding(padding)
381
+ .color('transparent')
382
+ .rounded('4px')
383
+ .build();
384
+ console.log(`%c${message}`, svgStyle);
385
+ }
386
+ /**
387
+ * Log with animated background gradient
388
+ */
389
+ logAnimated(message, duration = 3) {
390
+ // Inject CSS animation if not already present
391
+ if (!document.getElementById('logger-animations')) {
392
+ const style = document.createElement('style');
393
+ style.id = 'logger-animations';
394
+ style.textContent = `
395
+ @keyframes loggerGradient {
396
+ 0% { background-position: 0% 50%; }
397
+ 50% { background-position: 100% 50%; }
398
+ 100% { background-position: 0% 50%; }
399
+ }
400
+ `;
401
+ document.head.appendChild(style);
402
+ }
403
+ const animatedStyle = new StyleBuilder()
404
+ .bg('linear-gradient(-45deg, #667eea, #764ba2, #667eea, #764ba2)')
405
+ .css('background-size', '400% 400%')
406
+ .color('#ffffff')
407
+ .padding('12px 20px')
408
+ .rounded('8px')
409
+ .bold()
410
+ .font('Monaco, Consolas, monospace')
411
+ .animation(`loggerGradient ${duration}s ease infinite`)
412
+ .display('inline-block')
413
+ .build();
414
+ console.log(`%c${message}`, animatedStyle);
415
+ }
416
+ /**
417
+ * Groups logs by a specific property using modern Object.groupBy (when available)
418
+ */
419
+ logGrouped(items, groupBy) {
420
+ try {
421
+ // Use Object.groupBy if available (ES2024), otherwise fallback to reduce
422
+ let grouped;
423
+ if (Object.groupBy) {
424
+ grouped = Object.groupBy(items, groupBy);
425
+ }
426
+ else {
427
+ grouped = items.reduce((acc, item) => {
428
+ const key = groupBy(item);
429
+ if (!acc[key]) {
430
+ acc[key] = [];
431
+ }
432
+ acc[key].push(item);
433
+ return acc;
434
+ }, {});
435
+ }
436
+ Object.entries(grouped).forEach(([group, groupItems]) => {
437
+ this.group(`Group: ${group}`);
438
+ this.table(groupItems);
439
+ this.groupEnd();
440
+ });
441
+ }
442
+ catch {
443
+ this.info('Grouped data:', items);
444
+ }
445
+ }
446
+ // ===== CLI SYSTEM =====
447
+ /**
448
+ * CLI command processor for logger configuration and export
449
+ */
450
+ async cli(command) {
451
+ if (!this.cliProcessor) {
452
+ this.error('CLI processor not initialized');
453
+ return;
454
+ }
455
+ await this.cliProcessor.processCommand(command, this);
456
+ }
457
+ }
458
+ // Create and export the singleton instance
459
+ const defaultLogger = new Logger({
460
+ verbosity: 'info',
461
+ enableColors: true,
462
+ enableTimestamps: true,
463
+ enableStackTrace: true,
464
+ bufferSize: 1000, // Enable export functionality by default
465
+ });
466
+ // Display initialization banner
467
+ displayInitBanner();
468
+ // Export the singleton instance as default
469
+ export default defaultLogger;
470
+ /**
471
+ * Export individual methods for convenience (with proper binding)
472
+ */
473
+ export const debug = (...args) => defaultLogger.debug(...args);
474
+ export const info = (...args) => defaultLogger.info(...args);
475
+ export const warn = (...args) => defaultLogger.warn(...args);
476
+ export const error = (...args) => defaultLogger.error(...args);
477
+ export const success = (...args) => defaultLogger.success(...args);
478
+ export const trace = (...args) => defaultLogger.trace(...args);
479
+ export const critical = (...args) => defaultLogger.critical(...args);
480
+ export const table = (data, columns) => defaultLogger.table(data, columns);
481
+ export const group = (label, collapsed) => defaultLogger.group(label, collapsed);
482
+ export const groupEnd = () => defaultLogger.groupEnd();
483
+ export const time = (label) => defaultLogger.time(label);
484
+ export const timeEnd = (label) => defaultLogger.timeEnd(label);
485
+ export const setGlobalPrefix = (prefix) => defaultLogger.setGlobalPrefix(prefix);
486
+ export const createScopedLogger = (prefix) => defaultLogger.createScopedLogger(prefix);
487
+ export const setVerbosity = (level) => defaultLogger.setVerbosity(level);
488
+ export const addHandler = (handler) => defaultLogger.addHandler(handler);
489
+ export const setTheme = (theme) => defaultLogger.setTheme(theme);
490
+ export const setBannerType = (bannerType) => defaultLogger.setBannerType(bannerType);
491
+ export const showBanner = (bannerType) => defaultLogger.showBanner(bannerType);
492
+ export const logWithSVG = (message, svgContent, options) => defaultLogger.logWithSVG(message, svgContent, options);
493
+ export const logAnimated = (message, duration) => defaultLogger.logAnimated(message, duration);
494
+ export const cli = (command) => defaultLogger.cli(command);
495
+ // Re-export handlers and utilities for backward compatibility
496
+ export { FileLogHandler, RemoteLogHandler, AnalyticsLogHandler, ExportLogHandler } from './handlers/index.js';
497
+ export { StyleBuilder, StylePresets as Styles } from './styling/index.js'; // Test change to trigger workflow
498
+ // Test permissions fix
@@ -0,0 +1,2 @@
1
+ "use strict";const e=require("./StyleBuilder-LPLzsoHY.js"),o={default:{debug:{emoji:"๐Ÿž",label:"DEBUG",background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",color:"#ffffff",border:"1px solid #667eea",shadow:"0 2px 4px rgba(102, 126, 234, 0.3)"},info:{emoji:"โ„น๏ธ",label:"INFO",background:"linear-gradient(135deg, #74b9ff 0%, #0984e3 100%)",color:"#ffffff",border:"1px solid #74b9ff",shadow:"0 2px 4px rgba(116, 185, 255, 0.3)"},warn:{emoji:"โš ๏ธ",label:"WARN",background:"linear-gradient(135deg, #fdcb6e 0%, #e17055 100%)",color:"#2d3436",border:"1px solid #fdcb6e",shadow:"0 2px 4px rgba(253, 203, 110, 0.3)"},error:{emoji:"โŒ",label:"ERROR",background:"linear-gradient(135deg, #e84393 0%, #d63031 100%)",color:"#ffffff",border:"1px solid #e84393",shadow:"0 2px 4px rgba(232, 67, 147, 0.3)"},success:{emoji:"โœ…",label:"SUCCESS",background:"linear-gradient(135deg, #00b894 0%, #00a085 100%)",color:"#ffffff",border:"1px solid #00b894",shadow:"0 2px 4px rgba(0, 184, 148, 0.3)"},critical:{emoji:"๐Ÿ”ฅ",label:"CRITICAL",background:"linear-gradient(135deg, #ff3838 0%, #ff1744 100%)",color:"#ffffff",border:"2px solid #ff3838",shadow:"0 4px 8px rgba(255, 56, 56, 0.5)"}},dark:{debug:{emoji:"๐ŸŒ™",label:"DEBUG",background:"linear-gradient(135deg, #2d3748 0%, #4a5568 100%)",color:"#e2e8f0",border:"1px solid #4a5568",shadow:"0 2px 4px rgba(45, 55, 72, 0.8)"},info:{emoji:"๐Ÿ’ก",label:"INFO",background:"linear-gradient(135deg, #1a202c 0%, #2d3748 100%)",color:"#90cdf4",border:"1px solid #3182ce",shadow:"0 2px 4px rgba(26, 32, 44, 0.8)"},warn:{emoji:"โšก",label:"WARN",background:"linear-gradient(135deg, #744210 0%, #975a16 100%)",color:"#faf089",border:"1px solid #d69e2e",shadow:"0 2px 4px rgba(116, 66, 16, 0.8)"},error:{emoji:"๐Ÿ’€",label:"ERROR",background:"linear-gradient(135deg, #742a2a 0%, #9b2c2c 100%)",color:"#feb2b2",border:"1px solid #e53e3e",shadow:"0 2px 4px rgba(116, 42, 42, 0.8)"},success:{emoji:"๐ŸŽฏ",label:"SUCCESS",background:"linear-gradient(135deg, #276749 0%, #2f855a 100%)",color:"#9ae6b4",border:"1px solid #38a169",shadow:"0 2px 4px rgba(39, 103, 73, 0.8)"},critical:{emoji:"๐Ÿ’ฅ",label:"CRITICAL",background:"linear-gradient(135deg, #1a1a1a 0%, #ff0000 100%)",color:"#ffffff",border:"2px solid #ff0000",shadow:"0 4px 8px rgba(255, 0, 0, 0.9)"}},neon:{debug:{emoji:"โšก",label:"DEBUG",background:"linear-gradient(135deg, #0f3460 0%, #e94560 100%)",color:"#00ffff",border:"1px solid #00ffff",shadow:"0 0 10px rgba(0, 255, 255, 0.5)"},info:{emoji:"๐Ÿ”ฎ",label:"INFO",background:"linear-gradient(135deg, #16213e 0%, #0f3460 100%)",color:"#00ff41",border:"1px solid #00ff41",shadow:"0 0 10px rgba(0, 255, 65, 0.5)"},warn:{emoji:"โš ๏ธ",label:"WARN",background:"linear-gradient(135deg, #533a03 0%, #e94560 100%)",color:"#ffff00",border:"1px solid #ffff00",shadow:"0 0 10px rgba(255, 255, 0, 0.5)"},error:{emoji:"๐Ÿ’ฅ",label:"ERROR",background:"linear-gradient(135deg, #5c0a0a 0%, #ff073a 100%)",color:"#ff073a",border:"1px solid #ff073a",shadow:"0 0 10px rgba(255, 7, 58, 0.8)"},success:{emoji:"โœจ",label:"SUCCESS",background:"linear-gradient(135deg, #0a5c0a 0%, #39ff14 100%)",color:"#39ff14",border:"1px solid #39ff14",shadow:"0 0 10px rgba(57, 255, 20, 0.8)"},critical:{emoji:"๐ŸŒŸ",label:"CRITICAL",background:"linear-gradient(135deg, #000000 0%, #ff0080 100%)",color:"#ff0080",border:"2px solid #ff0080",shadow:"0 0 20px rgba(255, 0, 128, 1)"}},minimal:{debug:{emoji:"",label:"DEBUG",background:"#f7fafc",color:"#4a5568",border:"1px solid #e2e8f0",shadow:"none"},info:{emoji:"",label:"INFO",background:"#ebf8ff",color:"#2b6cb0",border:"1px solid #bee3f8",shadow:"none"},warn:{emoji:"",label:"WARN",background:"#fffbf0",color:"#c05621",border:"1px solid #fed7aa",shadow:"none"},error:{emoji:"",label:"ERROR",background:"#fef5f5",color:"#c53030",border:"1px solid #fca5a5",shadow:"none"},success:{emoji:"",label:"SUCCESS",background:"#f0fff4",color:"#2f855a",border:"1px solid #9ae6b4",shadow:"none"},critical:{emoji:"",label:"CRITICAL",background:"#fef5f5",color:"#e53e3e",border:"2px solid #f56565",shadow:"none"}},light:{debug:{emoji:"๐Ÿ”",label:"DEBUG",background:"linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%)",color:"#1565c0",border:"1px solid #90caf9",shadow:"0 1px 3px rgba(33, 150, 243, 0.2)"},info:{emoji:"โ„น๏ธ",label:"INFO",background:"linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%)",color:"#7b1fa2",border:"1px solid #ce93d8",shadow:"0 1px 3px rgba(156, 39, 176, 0.2)"},warn:{emoji:"โš ๏ธ",label:"WARN",background:"linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%)",color:"#f57c00",border:"1px solid #ffcc02",shadow:"0 1px 3px rgba(255, 152, 0, 0.2)"},error:{emoji:"โŒ",label:"ERROR",background:"linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%)",color:"#d32f2f",border:"1px solid #f44336",shadow:"0 1px 3px rgba(244, 67, 54, 0.2)"},success:{emoji:"โœ…",label:"SUCCESS",background:"linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%)",color:"#388e3c",border:"1px solid #4caf50",shadow:"0 1px 3px rgba(76, 175, 80, 0.2)"},critical:{emoji:"๐Ÿšจ",label:"CRITICAL",background:"linear-gradient(135deg, #fce4ec 0%, #f8bbd9 100%)",color:"#c2185b",border:"2px solid #e91e63",shadow:"0 2px 6px rgba(233, 30, 99, 0.3)"}},cyberpunk:{debug:{emoji:"๐Ÿค–",label:"DEBUG",background:"linear-gradient(135deg, #0d1b2a 0%, #415a77 100%)",color:"#00d4aa",border:"1px solid #00d4aa",shadow:"0 0 15px rgba(0, 212, 170, 0.4)"},info:{emoji:"๐Ÿ”—",label:"INFO",background:"linear-gradient(135deg, #1b263b 0%, #0d1b2a 100%)",color:"#00b4d8",border:"1px solid #00b4d8",shadow:"0 0 15px rgba(0, 180, 216, 0.4)"},warn:{emoji:"โšก",label:"WARN",background:"linear-gradient(135deg, #f72585 0%, #b5179e 100%)",color:"#ffff3f",border:"1px solid #ffff3f",shadow:"0 0 15px rgba(255, 255, 63, 0.4)"},error:{emoji:"๐Ÿ’€",label:"ERROR",background:"linear-gradient(135deg, #7209b7 0%, #480ca8 100%)",color:"#ff006e",border:"1px solid #ff006e",shadow:"0 0 15px rgba(255, 0, 110, 0.6)"},success:{emoji:"โšก",label:"SUCCESS",background:"linear-gradient(135deg, #003566 0%, #001d3d 100%)",color:"#00f5ff",border:"1px solid #00f5ff",shadow:"0 0 15px rgba(0, 245, 255, 0.4)"},critical:{emoji:"๐Ÿ’ฅ",label:"CRITICAL",background:"linear-gradient(135deg, #000000 0%, #ff0040 100%)",color:"#ff0040",border:"2px solid #ff0040",shadow:"0 0 25px rgba(255, 0, 64, 0.8)"}}},t={simple:{text:"๐Ÿš€ ADVANCED LOGGER v2.0.0 - State-of-the-art Console Styling ๐Ÿš€",style:"background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 12px 20px; border-radius: 8px; font-weight: bold; font-size: 14px;"},ascii:{text:"\n ___ ____ _ __ ___ _ __ _____ _____ ____ __ ___ _____ _____ _____ ____ \n / _ \\ / __ \\| | / / / _ \\ | \\ | |/ ____| ____| _ \\ | | / _ \\ / ____| ___| _ | _ \\ \n / /_\\ \\ / / _` | |/ / / /_\\ \\ | \\| | | | |__ | | | | | | / / \\ \\| | __| |_ | |_| | |_) |\n | _ || | (_| | < | _ | | . ` | | | __| | | | | | | | | | | | |_ | _| | /| _ < \n | | | |\\ \\__,_|_|\\_\\ | | | | | |\\ | |___| |____| |_| | | |__\\ \\_/ /| |__| | |___| |\\ \\| |_) |\n \\_| |_/ \\____/ \\_| |_/ |_| \\_|\\_____|______|____/ |_____/\\___/ \\_____|_____|_| \\_|____/\n\n Advanced Logger v2.0.0 - Console Excellence",style:'font-family: "Courier New", Consolas, Monaco, monospace; color: #667eea; font-size: 11px; line-height: 1.2;'},unicode:{text:"\nโ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—\nโ•‘ ๐Ÿš€ ADVANCED LOGGER v2.0.0 โ•‘\nโ•‘ State-of-the-art Console Styling โ•‘ \nโ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•",style:'font-family: "Courier New", Consolas, Monaco, monospace; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 15px; border-radius: 8px; font-size: 12px; line-height: 1.3;'},svg:{text:" ",style:"\n background-image: url(\"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 80'><defs><linearGradient id='grad' x1='0%' y1='0%' x2='100%' y2='0%'><stop offset='0%' style='stop-color:%23667eea'/><stop offset='100%' style='stop-color:%23764ba2'/></linearGradient></defs><rect width='100%' height='100%' fill='url(%23grad)' rx='8'/><text x='200' y='30' text-anchor='middle' fill='white' font-family='monospace' font-size='14' font-weight='bold'>๐Ÿš€ ADVANCED LOGGER</text><text x='200' y='50' text-anchor='middle' fill='white' font-family='monospace' font-size='12'>State-of-the-art Console Styling</text><text x='200' y='65' text-anchor='middle' fill='white' font-family='monospace' font-size='10'>v2.0.0</text></svg>\");\n background-repeat: no-repeat;\n background-size: 400px 80px;\n padding: 40px 200px;\n color: transparent;\n display: inline-block;\n border-radius: 8px;\n "},animated:{text:" ๐Ÿš€ ADVANCED LOGGER v2.0.0 ",style:"\n background: linear-gradient(-45deg, #667eea, #764ba2, #667eea, #764ba2);\n background-size: 400% 400%;\n color: white;\n padding: 15px 25px;\n border-radius: 10px;\n font-weight: bold;\n font-size: 14px;\n font-family: monospace;\n animation: gradientShift 3s ease infinite;\n display: inline-block;\n "}},r={default:{simple:"๐Ÿš€ ADVANCED LOGGER v2.0.0 - State-of-the-art Console Styling ๐Ÿš€",style:"background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 12px 20px; border-radius: 8px; font-weight: bold;"},dark:{simple:"๐ŸŒ™ ADVANCED LOGGER v2.0.0 - Dark Mode Console Excellence ๐ŸŒ™",style:"background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%); color: #e2e8f0; padding: 12px 20px; border-radius: 8px; font-weight: bold; border: 1px solid #4a5568;"},neon:{simple:"โšก ADVANCED LOGGER v2.0.0 - Cyberpunk Console Experience โšก",style:"background: linear-gradient(135deg, #0f3460 0%, #e94560 100%); color: #00ffff; padding: 12px 20px; border-radius: 8px; font-weight: bold; text-shadow: 0 0 10px #00ffff;"},minimal:{simple:"ADVANCED LOGGER v2.0.0 - Clean Console Styling",style:"background: #f7fafc; color: #2d3748; padding: 8px 16px; border: 1px solid #e2e8f0; border-radius: 4px; font-weight: 500;"},light:{simple:"โ˜€๏ธ ADVANCED LOGGER v2.0.0 - Bright Console Styling โ˜€๏ธ",style:"background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%); color: #495057; padding: 12px 20px; border-radius: 8px; font-weight: bold; border: 1px solid #dee2e6;"},cyberpunk:{simple:"๐Ÿค– ADVANCED LOGGER v2.0.0 - Neural Console Interface ๐Ÿค–",style:"background: linear-gradient(135deg, #0d1b2a 0%, #415a77 100%); color: #00d4aa; padding: 12px 20px; border-radius: 8px; font-weight: bold; text-shadow: 0 0 10px #00d4aa; border: 1px solid #00d4aa;"}};function displayInitBanner(e){const o=e||function(){const e=navigator.userAgent,o=/Chrome/.test(e),t=/Firefox/.test(e),r=/Safari/.test(e)&&!/Chrome/.test(e),n=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect;return"undefined"!=typeof document&&"animationName"in document.createElement("div").style&&o?"animated":n&&(o||t)?"svg":o||t?"unicode":r?"ascii":"simple"}(),r=t[o];if("animated"===o){const e=document.createElement("style");e.textContent="\n @keyframes gradientShift {\n 0% { background-position: 0% 50%; }\n 50% { background-position: 100% 50%; }\n 100% { background-position: 0% 50%; }\n }\n ",document.head.appendChild(e)}console.log(`%c${r.text}`,r.style),console.group("%cโœจ Features","background: #f8f9fa; color: #495057; padding: 4px 8px; border-radius: 4px; font-weight: bold;"),["๐ŸŽจ Advanced CSS Console Styling","๐Ÿ“ Automatic Stack Trace Parsing","๐Ÿ”ง Scoped Loggers & Prefixes","โšก Performance Timers","๐ŸŽฏ Verbosity Filtering","๐Ÿ”Œ Extensible Handlers","๐Ÿ“ฑ Modern TypeScript Patterns","๐Ÿ“ค Export & Clipboard Support"].forEach(e=>{console.log(`%c${e}`,"color: #6c757d; font-size: 13px;")}),console.groupEnd(),console.log("")}function createStyledOutput(o,t,r,n,a){const i=t[o],s=e.formatTimestamp(),l=(new e.StyleBuilder).color("#666").size("11px").font("Monaco, Consolas, monospace").build(),c=(new e.StyleBuilder).bg(i.background).color(i.color).border(i.border).shadow(i.shadow).padding("2px 8px").rounded("4px").bold().font("Monaco, Consolas, monospace").size("12px").build(),d=(new e.StyleBuilder).bg("#2d3748").color("#e2e8f0").padding("2px 6px").rounded("3px").bold().font("Monaco, Consolas, monospace").size("11px").build(),f=(new e.StyleBuilder).color("#2d3748").font("system-ui, -apple-system, sans-serif").size("14px").build(),g=(new e.StyleBuilder).color("#718096").size("11px").font("Monaco, Consolas, monospace").build();let p=`%c${s.slice(11,23)} %c${i.emoji} ${i.label}`;const m=[l,c];return r&&(p+=` %c${r}`,m.push(d)),p+=` %c${n}`,m.push(f),a&&(p+=` %c(${a.file}:${a.line}:${a.column})`,m.push(g)),[p,...m]}function escapeHtml(e){const o=document.createElement("div");return o.textContent=e,o.innerHTML}class ExportLogHandler{buffer=[];maxSize;groupDepth=0;currentGroup;constructor(o=e.BUFFER_LIMITS.DEFAULT_SIZE){this.maxSize=Math.min(Math.max(o,e.BUFFER_LIMITS.MIN_SIZE),e.BUFFER_LIMITS.MAX_SIZE)}handle(e,o,t,r){const n={id:`${Date.now()}-${Math.random().toString(36).substr(2,9)}`,timestamp:r.timestamp,level:e,prefix:r.prefix,message:o,args:t,location:r.stackInfo,groupInfo:this.groupDepth>0?{depth:this.groupDepth,groupName:this.currentGroup}:void 0};this.buffer.push(n),this.buffer.length>this.maxSize&&this.buffer.shift()}setGroupInfo(e,o){this.groupDepth=e,this.currentGroup=o}getBufferStats(){const e=this.buffer.reduce((e,o)=>{const t=e[o.level]?e[o.level]:0;return e[o.level]=t+1,e},{});let o,t;if(this.buffer.length>0){const e=this.buffer[0],r=this.buffer[this.buffer.length-1];e&&e.timestamp&&(o=new Date(e.timestamp)),r&&r.timestamp&&(t=new Date(r.timestamp))}return{size:this.buffer.length,maxSize:this.maxSize,usage:this.buffer.length/this.maxSize*100,oldestLog:o,newestLog:t,levelCounts:{debug:e.debug?e.debug:0,info:e.info?e.info:0,warn:e.warn?e.warn:0,error:e.error?e.error:0,critical:e.critical?e.critical:0}}}clearBuffer(){this.buffer=[]}setBufferSize(o){this.maxSize=Math.min(Math.max(o,e.BUFFER_LIMITS.MIN_SIZE),e.BUFFER_LIMITS.MAX_SIZE),this.buffer.length>this.maxSize&&(this.buffer=this.buffer.slice(-this.maxSize))}filterLogs(o={}){let t=[...this.buffer];if(o.levels?.length&&(t=t.filter(e=>o.levels.includes(e.level))),o.prefixes?.length&&(t=t.filter(e=>e.prefix&&o.prefixes.includes(e.prefix))),o.excludePrefixes?.length&&(t=t.filter(e=>!e.prefix||!o.excludePrefixes.includes(e.prefix))),o.since){const r=e.parseTimeInput(o.since);t=t.filter(e=>new Date(e.timestamp)>=r)}if(o.until){const r=e.parseTimeInput(o.until);t=t.filter(e=>new Date(e.timestamp)<=r)}if(o.withStackTrace&&(t=t.filter(e=>e.location)),o.errorsOnly&&(t=t.filter(e=>"error"===e.level||"critical"===e.level)),o.search){const e=o.search.toLowerCase();t=t.filter(o=>o.message.toLowerCase().includes(e)||o.args.some(o=>String(o).toLowerCase().includes(e)))}return o.last&&(t=t.slice(-o.last)),o.first&&(t=t.slice(0,o.first)),t}exportJSON(e,o){const t=e.map(e=>({timestamp:e.timestamp,level:e.level,prefix:e.prefix,message:e.message,...o.minimal?{}:{args:e.args.slice(1),location:e.location,groupInfo:e.groupInfo}}));return o.compact?JSON.stringify(t):JSON.stringify(t,null,2)}exportCSV(o,t){const r=t.minimal?["Timestamp","Level","Prefix","Message"]:["Timestamp","Level","Prefix","Message","File","Line","Args"],n=o.map(o=>{const r=[e.formatDisplayTime(new Date(o.timestamp),"full"),o.level.toUpperCase(),o.prefix||"",`"${o.message.replace(/"/g,'""')}"`];return t.minimal||r.push(o.location?.file||"",o.location?.line?.toString()||"",`"${function(e){try{return JSON.stringify(e,(e,o)=>"function"==typeof o?"[Function]":o instanceof Error?`[Error: ${o.message}]`:o instanceof Date?o.toISOString():void 0===o?"[undefined]":o,2)}catch(o){return String(e)}}(o.args.slice(1)).replace(/"/g,'""')}"`),r});return[r.join(","),...n.map(e=>e.join(","))].join("\n")}exportMarkdown(o,t){const r=/* @__PURE__ */new Date;let n=`# Log Export - ${e.formatDisplayTime(r,"full")}\n\n`;if(!t.minimal){const e=this.getBufferStats();n+="## Summary\n",n+=`- **Total logs**: ${o.length}\n`,n+=`- **Errors**: ${e.levelCounts.error+e.levelCounts.critical}\n`,n+=`- **Warnings**: ${e.levelCounts.warn}\n\n`}if("level"===t.groupBy){const t=o.reduce((e,o)=>{const t=o.level;e[t]||(e[t]=[]);const r=e[t];return r&&r.push(o),e},{});Object.entries(t).forEach(([o,t])=>{const r=this.getLevelEmoji(o);n+=`## ${r} ${o.toUpperCase()} (${t.length})\n\n`,t.forEach(o=>{const t=e.formatDisplayTime(new Date(o.timestamp),"time-only"),r=o.location?` (${o.location.file}:${o.location.line})`:"",a=o.prefix?` **${o.prefix}**:`:"";n+=`- \`${t}\`${a} ${o.message}${r}\n`}),n+="\n"})}else n+="## Logs\n\n",o.forEach(o=>{const t=e.formatDisplayTime(new Date(o.timestamp),"time-only"),r=this.getLevelEmoji(o.level),a=o.location?` (${o.location.file}:${o.location.line})`:"",i=o.prefix?` **${o.prefix}**:`:"";n+=`- \`${t}\` ${r}${i} ${o.message}${a}\n`});return n}exportPlain(o,t){return o.map(o=>{const r=e.formatDisplayTime(new Date(o.timestamp),t.minimal?"time-only":"short"),n=o.level.toUpperCase().padEnd(8),a=o.prefix?`[${o.prefix}] `:"",i=!t.minimal&&o.location?` (${o.location.file}:${o.location.line})`:"";return`${r} ${n} ${a}${o.message}${i}`}).join("\n")}exportHTML(o,t){const r=`Log Export - ${e.formatDisplayTime(/* @__PURE__ */new Date,"full")}`;let n=`<!DOCTYPE html>\n<html lang="en">\n<head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>${r}</title>\n <style>\n body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; margin: 20px; line-height: 1.6; }\n .header { border-bottom: 2px solid #ddd; padding-bottom: 20px; margin-bottom: 20px; }\n .log-entry { margin: 5px 0; padding: 8px; border-radius: 4px; font-family: 'Monaco', 'Consolas', monospace; }\n .timestamp { color: #666; font-size: 0.9em; }\n .level { font-weight: bold; padding: 2px 6px; border-radius: 3px; margin: 0 8px; }\n .prefix { background: #2d3748; color: #e2e8f0; padding: 2px 6px; border-radius: 3px; margin: 0 8px; }\n .location { color: #718096; font-size: 0.9em; }\n .debug { background: #f0f4ff; }\n .info { background: #f0f9ff; }\n .warn { background: #fffbeb; }\n .error { background: #fef2f2; }\n .critical { background: #fef2f2; border-left: 4px solid #dc2626; }\n .level.debug { background: #667eea; color: white; }\n .level.info { background: #74b9ff; color: white; }\n .level.warn { background: #fdcb6e; color: #2d3436; }\n .level.error { background: #e84393; color: white; }\n .level.critical { background: #ff3838; color: white; }\n </style>\n</head>\n<body>\n <div class="header">\n <h1>${r}</h1>\n <p>Generated by Advanced Logger v2.0.0</p>\n </div>\n <div class="logs">`;return o.forEach(o=>{const t=e.formatDisplayTime(new Date(o.timestamp),"full"),r=o.location?` <span class="location">(${escapeHtml(o.location.file)}:${o.location.line})</span>`:"",a=o.prefix?` <span class="prefix">${escapeHtml(o.prefix)}</span>`:"";n+=`\n <div class="log-entry ${o.level}">\n <span class="timestamp">${t}</span>\n <span class="level ${o.level}">${o.level.toUpperCase()}</span>\n ${a}\n <span class="message">${escapeHtml(o.message)}</span>\n ${r}\n </div>`}),n+="\n </div>\n</body>\n</html>",n}getLevelEmoji(e){return{debug:"๐Ÿž",info:"โ„น๏ธ",warn:"โš ๏ธ",error:"โŒ",critical:"๐Ÿ”ฅ"}[e]||""}export(e,o={},t={}){const r=this.filterLogs(o);let n;switch(e){case"json":n=this.exportJSON(r,t);break;case"csv":n=this.exportCSV(r,t);break;case"markdown":n=this.exportMarkdown(r,t);break;case"plain":n=this.exportPlain(r,t);break;case"html":n=this.exportHTML(r,t);break;default:throw new Error(`Unsupported export format: ${e}`)}return{format:e,data:n,metadata:{totalLogs:this.buffer.length,filteredLogs:r.length,exportedAt:/* @__PURE__ */(new Date).toISOString(),filters:o,options:t}}}async copyToClipboard(e,o={},t={}){const r=this.export(e,o,t);try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(r.data),!0;{const e=document.createElement("textarea");e.value=r.data,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.focus(),e.select();const o=document.execCommand("copy");return document.body.removeChild(e),o}}catch(n){return console.error("Failed to copy to clipboard:",n),!1}}getAllLogs(){return[...this.buffer]}async saveToFile(e,o={},t={}){try{const r=this.export(e,o,t),n=new Blob([r.data],{type:this.getMimeType(e)}),a=URL.createObjectURL(n),i=document.createElement("a"),s=this.generateFilename(e,o);return i.href=a,i.download=s,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(a),!0}catch(r){return console.error("Failed to save file:",r),!1}}getMimeType(e){return{json:"application/json",csv:"text/csv",markdown:"text/markdown",plain:"text/plain",html:"text/html"}[e]||"text/plain"}generateFilename(e,o){const t=/* @__PURE__ */(new Date).toISOString().replace(/[:.]/g,"-").slice(0,-5);return`logs${1===o.prefixes?.length?`_${o.prefixes[0]}`:""}_${t}.${"markdown"===e?"md":e}`}async streamToEndpoint(e,o={},t={}){try{const r=this.filterLogs(o),n=t.batchSize||100,a=t.format||"json";for(let o=0;o<r.length;o+=n){const i=r.slice(o,o+n),s=(this.export(a,{},{compact:!0}),{"Content-Type":"application/json"});t.apiKey&&(s.Authorization=`Bearer ${t.apiKey}`);const l=await fetch(e,{method:"POST",headers:s,body:JSON.stringify({logs:i,metadata:{batchIndex:Math.floor(o/n),totalBatches:Math.ceil(r.length/n),timestamp:/* @__PURE__ */(new Date).toISOString()}})});if(!l.ok)throw new Error(`HTTP ${l.status}: ${l.statusText}`)}return!0}catch(r){return console.error("Failed to stream logs:",r),!1}}exportWithMetadata(e,o={},t={}){const r=this.export(e,o,t),n=this.getBufferStats();return{...r,metadata:{...r.metadata,bufferStats:n,performance:{memoryUsage:this.estimateMemoryUsage(),processingTime:Date.now()},system:{userAgent:"undefined"!=typeof navigator?navigator.userAgent:"Node.js",timestamp:/* @__PURE__ */(new Date).toISOString(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}}}}estimateMemoryUsage(){const e=this.buffer[0];return e?JSON.stringify(e).length*this.buffer.length:0}}class CommandProcessor{commands=/* @__PURE__ */new Map;aliases=/* @__PURE__ */new Map;plugins=/* @__PURE__ */new Map;history=[];maxHistorySize=100;isInteractiveMode=!1;registerCommand(e){if(this.commands.set(e.name,e),e.aliases)for(const o of e.aliases)this.aliases.set(o,e.name)}registerPlugin(e,o){if(this.plugins.has(e.name))throw new Error(`Plugin ${e.name} is already registered`);this.plugins.set(e.name,e);for(const t of e.commands)this.registerCommand(t);e.initialize&&o&&e.initialize(this,o)}unregisterPlugin(e){const o=this.plugins.get(e);if(o){for(const e of o.commands)if(this.commands.delete(e.name),e.aliases)for(const o of e.aliases)this.aliases.delete(o);o.cleanup&&o.cleanup(),this.plugins.delete(e)}}getCommands(){return Array.from(this.commands.values())}getCommand(e){let o=this.commands.get(e);if(o)return o;const t=this.aliases.get(e);return t?this.commands.get(t):void 0}getHistory(){return[...this.history]}clearHistory(){this.history=[]}getPlugins(){return Array.from(this.plugins.values())}enterInteractiveMode(e){this.isInteractiveMode=!0,e.info("๐Ÿ”ง Interactive CLI mode activated. Type /exit to quit, /help for commands."),"undefined"!=typeof window&&this.setupBrowserInteractiveMode(e)}exitInteractiveMode(){this.isInteractiveMode=!1}setupBrowserInteractiveMode(e){window.cli=o=>this.processCommand(`/${o}`,e),e.info('๐Ÿ’ก Use cli("command") to execute CLI commands in browser console.')}async processCommand(e,o){if(!e.startsWith("/"))return o.error("Invalid command. Commands must start with /"),void this.addToHistory(e,!1);const t=e.slice(1).split(" "),r=t[0]||"",n=t.slice(1).join(" "),a=this.getCommand(r);if(!a){o.error(`Unknown command: ${r}. Type /help for available commands.`);const t=this.getSuggestions(r);return t.length>0&&o.info(`๐Ÿ“‹ Did you mean: ${t.slice(0,3).join(", ")}?`),void this.addToHistory(e,!1)}try{await a.execute(n||"",o),this.addToHistory(e,!0)}catch(i){o.error(`Command '${r}' failed:`,i),this.addToHistory(e,!1)}}addToHistory(e,o){this.history.unshift({command:e,timestamp:/* @__PURE__ */new Date,success:o}),this.history.length>this.maxHistorySize&&(this.history=this.history.slice(0,this.maxHistorySize))}getSuggestions(e){return Array.from(this.commands.keys()).filter(o=>o.startsWith(e))}}class ConfigCommand{name="config";description="Show or update logger configuration";usage="/config [json|key=value,...]";execute(e,o){if(e)try{if(e.startsWith("{")){const t=JSON.parse(e);this.applyConfig(t,o)}else{const t=e.split(",").map(e=>e.trim().split("=")),r={};t.forEach(([e,o])=>{e&&o&&(r[e.trim()]=o.trim().replace(/["']/g,""))}),this.applyConfig(r,o)}}catch(t){o.error("Invalid config format. Use JSON or key=value pairs:",t),o.info('Examples: /config {"theme":"dark"} or /config theme=neon,verbosity=debug')}else this.showStatus(o)}showStatus(e){const o={theme:e.getConfig().theme||"default",verbosity:e.getConfig().verbosity,colors:e.getConfig().enableColors,timestamps:e.getConfig().enableTimestamps,stackTrace:e.getConfig().enableStackTrace,globalPrefix:e.getConfig().globalPrefix||"none",bannerType:e.getConfig().bannerType||"simple",handlers:e.getHandlers().length};e.group("โš™๏ธ Logger Configuration"),e.table(o),e.groupEnd()}applyConfig(e,o){const t=["theme","verbosity","enableColors","enableTimestamps","enableStackTrace","globalPrefix","bannerType"],r=[];Object.entries(e).forEach(([e,n])=>{t.includes(e)?"theme"===e&&"string"==typeof n?(o.setTheme(n),r.push(`${e}=${n}`)):"bannerType"===e&&"string"==typeof n?(o.setBannerType(n),r.push(`${e}=${n}`)):"verbosity"===e?(o.setVerbosity(n),r.push(`${e}=${n}`)):"globalPrefix"===e?(o.setGlobalPrefix(n),r.push(`${e}=${n}`)):(o.updateConfig({[e]:n}),r.push(`${e}=${n}`)):o.warn(`Invalid config key: ${e}`)}),r.length>0&&o.success(`Configuration updated: ${r.join(", ")}`)}}class ThemesCommand{name="themes";description="Show available theme presets";usage="/themes";execute(t,r){r.group("๐ŸŽจ Available Themes"),Object.keys(o).forEach(t=>{const r=o[t],n=(new e.StyleBuilder).bg(r.info.background).color(r.info.color).padding("4px 8px").rounded("4px").border(r.info.border).build();console.log(`%c${t}`,n,`- ${t} theme preview`)}),r.groupEnd()}}class BannersCommand{name="banners";description="Show available banner types";usage="/banners";execute(e,o){o.group("๐Ÿ–ผ๏ธ Available Banner Types"),Object.keys(t).forEach(e=>{const o=t[e];console.log(`%c${e}`,"font-weight: bold; color: #667eea;"),console.log("%cPreview:","color: #666; font-size: 12px;"),"simple"===e?console.log(`%c${o.text}`,o.style):"ascii"===e?console.log(`%c${o.text.split("\n").slice(1,4).join("\n")}...`,"font-family: monospace; color: #667eea; font-size: 10px;"):"unicode"===e?console.log(`%c${o.text}`,o.style):console.log(`%c${e} banner`,"color: #666; font-style: italic;")}),o.groupEnd()}}class BannerCommand{name="banner";description="Change or show current banner type";usage="/banner [type]";execute(e,o){e?e in t?(o.setBannerType(e),o.showBanner()):o.error(`Invalid banner type: ${e}. Available: ${Object.keys(t).join(", ")}`):o.showBanner()}}class StatusCommand{name="status";description="Show current logger status and configuration";usage="/status";execute(e,o){const t=o.getConfig(),r={theme:t.theme?t.theme:"default",verbosity:t.verbosity,colors:t.enableColors,timestamps:t.enableTimestamps,stackTrace:t.enableStackTrace,globalPrefix:t.globalPrefix?t.globalPrefix:"none",bannerType:t.bannerType?t.bannerType:"simple",handlers:o.getHandlers().length,bufferSize:t.bufferSize?t.bufferSize:1e3};o.group("โš™๏ธ Logger Configuration"),o.table(r),o.groupEnd();const n=o.getExportHandler();if(n){const e=n.getBufferStats();o.group("๐Ÿ“Š Buffer Statistics"),o.table({size:`${e.size}/${e.maxSize}`,usage:`${e.usage.toFixed(1)}%`,oldestLog:e.oldestLog?e.oldestLog.toISOString():"None",newestLog:e.newestLog?e.newestLog.toISOString():"None",errorCount:e.levelCounts.error+e.levelCounts.critical,warningCount:e.levelCounts.warn}),o.groupEnd()}}}class ResetCommand{name="reset";description="Reset logger configuration to defaults";usage="/reset";execute(e,o){o.resetConfig()}}class DemoCommand{name="demo";description="Show comprehensive feature demonstration";usage="/demo";execute(e,o){o.group("๐ŸŽช Advanced Logger Demo"),o.debug("Debug message with detailed information"),o.info("Informational message about system state"),o.warn("Warning about deprecated feature"),o.error("Error processing user request"),o.success("Operation completed successfully"),o.critical("Critical system failure detected"),o.group("๐Ÿ“Š Advanced Features Demo"),o.table([{feature:"Styled Console",status:"โœ… Active",performance:"Excellent"},{feature:"Theme System",status:"โœ… Active",performance:"Great"},{feature:"CLI Interface",status:"โœ… Active",performance:"Good"},{feature:"Export System",status:"โœ… Active",performance:"Excellent"}]),o.time("demo-operation"),setTimeout(()=>{o.timeEnd("demo-operation")},100),o.logWithSVG("SVG Demo"),o.logAnimated("๐ŸŒŸ Animated Logger Demo ๐ŸŒŸ",2),o.groupEnd(),o.groupEnd(),o.info("Demo completed! Check the console for styled output.")}}function parseArguments(o){const t={},r={};let n;if(!o.trim())return{filters:t,options:r};const a=o.match(/(?:[^\s"]+|"[^"]*")+/g)||[];for(let i=0;i<a.length;i++){const o=a[i];if(o)if(0!==i||o.startsWith("--")||!(o in e.EXPORT_FORMATS)){if(o.startsWith("--")){const[e,n]=o.slice(2).split("=");switch(e){case"level":case"levels":n&&(t.levels=n.split(",").map(e=>e.trim()));break;case"since":n&&(t.since=n);break;case"until":n&&(t.until=n);break;case"prefix":case"prefixes":n&&(t.prefixes=n.split(",").map(e=>e.trim()));break;case"exclude-prefix":case"exclude-prefixes":n&&(t.excludePrefixes=n.split(",").map(e=>e.trim()));break;case"last":n&&(t.last=parseInt(n,10));break;case"first":n&&(t.first=parseInt(n,10));break;case"search":n&&(t.search=n.replace(/['"]/g,""));break;case"with-stack":t.withStackTrace=!0;break;case"errors-only":t.errorsOnly=!0;break;case"group-by":n&&(t.groupBy=n,r.groupBy=n);break;case"minimal":r.minimal=!0;break;case"compact":r.compact=!0;break;case"styled":r.styled=!0}}}else n=o}return{filters:t,options:r,format:n}}class ExportCommand{name="export";description="Export logs to various formats";usage="/export <format> [--filter=value] [--option]";execute(o,t){const r=t.getExportHandler();if(!r)return void t.error("Export handler not available. Make sure ExportLogHandler is registered.");const{filters:n,options:a,format:i}=parseArguments(o);if(!i)return t.error("Format required. Available formats: "+Object.keys(e.EXPORT_FORMATS).join(", ")),t.info("Usage: /export <format> [--filter=value]"),void t.info("Example: /export json --level=error,warn --last=50");try{const e=r.export(i,n,a);t.success(`โœ… Export completed: ${e.metadata.filteredLogs} logs exported in ${i} format`),e.data.length<1e3?(t.group(`๐Ÿ“„ Preview (${i.toUpperCase()})`),console.log(e.data),t.groupEnd()):t.info(`๐Ÿ“„ Export size: ${(e.data.length/1024).toFixed(2)}KB`),t.table({format:e.format,totalLogs:e.metadata.totalLogs,filtered:e.metadata.filteredLogs,exported:e.metadata.exportedAt})}catch(s){t.error("Export failed:",s)}}}class CopyCommand{name="copy";description="Copy logs to clipboard";usage="/copy <format> [--filter=value] [--option]";async execute(o,t){const r=t.getExportHandler();if(!r)return void t.error("Export handler not available. Make sure ExportLogHandler is registered.");const{filters:n,options:a,format:i}=parseArguments(o);if(!i)return t.error("Format required. Available formats: "+Object.keys(e.EXPORT_FORMATS).join(", ")),t.info("Usage: /copy <format> [--filter=value]"),void t.info("Example: /copy plain --level=error --last=25");try{if(await r.copyToClipboard(i,n,a)){const e=r.export(i,n,a);t.success(`๐Ÿ“‹ Copied ${e.metadata.filteredLogs} logs to clipboard (${i} format)`)}else t.error("Failed to copy to clipboard. Browser may not support clipboard API.")}catch(s){t.error("Copy failed:",s)}}}class BufferSizeCommand{name="buffer-size";description="Set log buffer size";usage="/buffer-size <size>";execute(e,o){const t=o.getExportHandler();if(!t)return void o.error("Export handler not available.");const r=parseInt(e.trim(),10);if(isNaN(r)||r<=0)return o.error("Invalid buffer size. Must be a positive number."),void o.info("Example: /buffer-size 2000");t.setBufferSize(r),o.success(`Buffer size set to ${r}`)}}class ClearBufferCommand{name="clear-buffer";description="Clear the log buffer";usage="/clear-buffer";execute(e,o){const t=o.getExportHandler();if(!t)return void o.error("Export handler not available.");const r=t.getBufferStats();t.clearBuffer(),o.success(`โœ… Buffer cleared. Removed ${r.size} log entries.`)}}class BufferInfoCommand{name="buffer-info";description="Show buffer statistics and information";usage="/buffer-info";execute(e,o){const t=o.getExportHandler();if(!t)return void o.error("Export handler not available.");const r=t.getBufferStats();o.group("๐Ÿ“Š Buffer Information"),o.table({size:`${r.size}/${r.maxSize}`,usage:`${r.usage.toFixed(1)}%`,oldestLog:r.oldestLog?.toLocaleString()||"None",newestLog:r.newestLog?.toLocaleString()||"None"}),o.group("๐Ÿ“ˆ Log Level Counts"),o.table(r.levelCounts),o.groupEnd(),o.groupEnd()}}class HelpCommand{name="help";description="Show CLI help and available commands";usage="/help [command]";execute(o,t){const r=(new e.StyleBuilder).bg("linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%)").color("#495057").padding("15px 20px").rounded("8px").border("1px solid #dee2e6").font("Monaco, Consolas, monospace").size("13px").build();console.log('%c\nโ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ADVANCED LOGGER CLI COMMANDS โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ\nโ”‚ โ”‚\nโ”‚ CONFIGURATION โ”‚\nโ”‚ /config Show current configuration โ”‚\nโ”‚ /config {json} Apply JSON configuration โ”‚\nโ”‚ /config key=val Apply key-value configuration โ”‚\nโ”‚ /themes Show available themes โ”‚\nโ”‚ /banners Show available banner types โ”‚\nโ”‚ /banner [type] Change/show banner type โ”‚\nโ”‚ /status Show logger status & buffer stats โ”‚\nโ”‚ /demo Show feature demonstration โ”‚\nโ”‚ /reset Reset to default configuration โ”‚\nโ”‚ โ”‚\nโ”‚ EXPORT & CLIPBOARD โ”‚\nโ”‚ /export <format> Export logs (json|csv|md|plain|html) โ”‚\nโ”‚ /copy <format> Copy logs to clipboard โ”‚\nโ”‚ /buffer-size N Set log buffer size โ”‚\nโ”‚ /buffer-info Show buffer statistics โ”‚\nโ”‚ /clear-buffer Clear stored logs โ”‚\nโ”‚ โ”‚\nโ”‚ EXPORT FILTERS (for export/copy commands) โ”‚\nโ”‚ --level error,warn Filter by log levels โ”‚\nโ”‚ --since 2h Logs from last 2 hours โ”‚\nโ”‚ --until 1h Logs until 1 hour ago โ”‚\nโ”‚ --prefix API,DB Filter by prefixes โ”‚\nโ”‚ --exclude-prefix INT Exclude prefixes โ”‚\nโ”‚ --last 50 Last 50 logs only โ”‚\nโ”‚ --first 25 First 25 logs only โ”‚\nโ”‚ --search "error" Search in log messages โ”‚\nโ”‚ --with-stack Only logs with stack traces โ”‚\nโ”‚ --errors-only Only error + critical logs โ”‚\nโ”‚ --group-by level Group by level/prefix/hour โ”‚\nโ”‚ โ”‚\nโ”‚ EXPORT OPTIONS โ”‚\nโ”‚ --minimal Minimal output format โ”‚\nโ”‚ --compact Remove extra whitespace โ”‚\nโ”‚ --styled Include styling (HTML format) โ”‚\nโ”‚ โ”‚\nโ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ CONFIGURATION OPTIONS โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค\nโ”‚ โ”‚\nโ”‚ theme: default | dark | light | neon | minimal | cyberpunkโ”‚\nโ”‚ bannerType: simple | ascii | unicode | svg | animated โ”‚\nโ”‚ verbosity: debug | info | warn | error | critical | silentโ”‚\nโ”‚ enableColors: true | false โ”‚\nโ”‚ enableTimestamps: true | false โ”‚\nโ”‚ enableStackTrace: true | false โ”‚\nโ”‚ globalPrefix: "string" โ”‚\nโ”‚ bufferSize: number (50-10000) โ”‚\nโ”‚ โ”‚\nโ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ EXAMPLES โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค\nโ”‚ โ”‚\nโ”‚ Basic Configuration: โ”‚\nโ”‚ /config {"theme":"dark","verbosity":"debug"} โ”‚\nโ”‚ /config theme=neon,bufferSize=2000 โ”‚\nโ”‚ /banner animated Change to animated banner โ”‚\nโ”‚ โ”‚\nโ”‚ Export Examples: โ”‚\nโ”‚ /export json --level=error,warn --last=25 โ”‚\nโ”‚ /export csv --since=2h --prefix=API โ”‚\nโ”‚ /export markdown --group-by=level --errors-only โ”‚\nโ”‚ /export html --styled --since=1h โ”‚\nโ”‚ โ”‚\nโ”‚ Clipboard Examples: โ”‚\nโ”‚ /copy plain --minimal --last=10 โ”‚\nโ”‚ /copy json --search="authentication" --compact โ”‚\nโ”‚ /copy csv --since=30m --exclude-prefix=DEBUG โ”‚\nโ”‚ โ”‚\nโ”‚ Buffer Management: โ”‚\nโ”‚ /buffer-size 5000 Increase buffer to 5000 logs โ”‚\nโ”‚ /buffer-info Show detailed buffer statistics โ”‚\nโ”‚ /clear-buffer Clear all stored logs โ”‚\nโ”‚ โ”‚\nโ”‚ Time Formats: โ”‚\nโ”‚ --since=2h 2 hours ago โ”‚\nโ”‚ --since=30m 30 minutes ago โ”‚\nโ”‚ --since=1d 1 day ago โ”‚\nโ”‚ --since="2024-01-01T10:00:00Z" Specific ISO date โ”‚\nโ”‚ โ”‚\nโ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ',r),t.group("๐Ÿ’ก Quick Tips"),["Use /demo to see all logger features in action","Logs are automatically stored in a circular buffer for export","Export formats: JSON (structured), CSV (Excel), Markdown (readable), Plain (simple), HTML (styled)","Time filters support relative (2h, 30m) and absolute (ISO) formats",'Combine multiple filters: /export json --level=error --since=1h --search="auth"',"Use /copy for quick clipboard access instead of /export"].forEach(e=>{t.info(`โ€ข ${e}`)}),t.groupEnd()}}class HistoryCommand{name="history";description="Show command execution history";usage="/history [limit] - Show recent commands (default: 10)";category="system";aliases=["hist","h"];execute(e,o){const t=o.cliProcessor;if(!t)return void o.error("CLI processor not available");const r=parseInt(e)||10,n=t.getHistory().slice(0,r);0!==n.length?(o.info(`๐Ÿ“‹ Last ${n.length} commands:`),n.forEach((e,t)=>{const r=e.success?"โœ…":"โŒ",n=e.timestamp.toLocaleTimeString();o.info(`${r} [${n}] ${e.command}`)})):o.info("๐Ÿ“ No command history available")}}class ClearHistoryCommand{name="clearhistory";description="Clear command execution history";usage="/clearhistory - Remove all command history";category="system";aliases=["clrhist"];execute(e,o){const t=o.cliProcessor;t?(t.clearHistory(),o.success("๐Ÿ—‘๏ธ Command history cleared")):o.error("CLI processor not available")}}class InteractiveCommand{name="interactive";description="Enter interactive CLI mode";usage="/interactive - Start interactive command mode";category="system";aliases=["i","repl"];execute(e,o){const t=o.cliProcessor;t?t.enterInteractiveMode(o):o.error("CLI processor not available")}}class PluginsCommand{name="plugins";description="List loaded CLI plugins";usage="/plugins - Show all registered plugins";category="system";aliases=["plug"];execute(e,o){const t=o.cliProcessor;if(!t)return void o.error("CLI processor not available");const r=t.getPlugins();0!==r.length?(o.info(`๐Ÿ”Œ Loaded plugins (${r.length}):`),r.forEach(e=>{o.info(` ๐Ÿ“ฆ ${e.name} v${e.version} - ${e.description}`),o.info(` Commands: ${e.commands.map(e=>e.name).join(", ")}`)})):o.info("๐Ÿ”Œ No plugins registered")}}let n=o.default;class Logger{config;scopedPrefix;handlers=[];timers=/* @__PURE__ */new Map;groupDepth=0;exportHandler;cliProcessor;constructor(o={}){this.config={...e.DEFAULT_CONFIG,...o},this.config.bufferSize&&(this.exportHandler=new ExportLogHandler(this.config.bufferSize),this.handlers.push(this.exportHandler)),this.cliProcessor=function(){const e=new CommandProcessor;return e.registerCommand(new HelpCommand),e.registerCommand(new ConfigCommand),e.registerCommand(new ThemesCommand),e.registerCommand(new BannersCommand),e.registerCommand(new BannerCommand),e.registerCommand(new StatusCommand),e.registerCommand(new ResetCommand),e.registerCommand(new DemoCommand),e.registerCommand(new ExportCommand),e.registerCommand(new CopyCommand),e.registerCommand(new BufferSizeCommand),e.registerCommand(new ClearBufferCommand),e.registerCommand(new BufferInfoCommand),e.registerCommand(new HistoryCommand),e.registerCommand(new ClearHistoryCommand),e.registerCommand(new InteractiveCommand),e.registerCommand(new PluginsCommand),e}()}getConfig(){return{...this.config}}updateConfig(e){this.config={...this.config,...e}}setGlobalPrefix(e){this.config.globalPrefix=e}setVerbosity(e){this.config.verbosity=e}setTheme(e){if(e in o){if(n=o[e],this.config.theme=e,e in r){const o=r[e];console.log(`%c${o.simple}`,o.style)}this.success(`Theme changed to: ${e}`)}else this.error(`Invalid theme: ${e}. Available themes:`,Object.keys(o))}setBannerType(e){this.config.bannerType=e,this.success(`Banner type changed to: ${e}`)}resetConfig(){this.config={...e.DEFAULT_CONFIG},n=o.default,this.success("Logger configuration reset to defaults")}createScopedLogger(e){const o=new Logger(this.config);return o.scopedPrefix=e,o.handlers=[...this.handlers],o.exportHandler=this.exportHandler,o}addHandler(e){this.handlers.push(e)}getHandlers(){return[...this.handlers]}getExportHandler(){return this.exportHandler}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.config.enableStackTrace?e.parseStackTrace():null,a=this.getEffectivePrefix(),i=t.length>0?String(t[0]):"",s=t.slice(1),[l,...c]=createStyledOutput(o,n,a,i,r),d=" ".repeat(this.groupDepth)+l;s.length>0?console.log(d,...c,...s):console.log(d,...c),this.exportHandler&&this.exportHandler.setGroupInfo(this.groupDepth);const f={timestamp:e.formatTimestamp(),level:o,prefix:a,stackInfo:r||void 0};this.handlers.forEach(e=>{try{e.handle(o,i,t,f)}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)}success(...o){if(!this.shouldLog("info"))return;const t=this.config.enableStackTrace?e.parseStackTrace():null,r=this.getEffectivePrefix(),a=o.length>0?String(o[0]):"",i=o.slice(1),[s,...l]=createStyledOutput("info",n,r,a,t),c=n.success;let d="โœ…",f="SUCCESS";c&&(c.emoji&&(d=c.emoji),c.label&&(f=c.label));const g=s.replace(/โ„น๏ธ INFO/,`${d} ${f}`),p=" ".repeat(this.groupDepth)+g;i.length>0?console.log(p,...l,...i):console.log(p,...l);const m={timestamp:e.formatTimestamp(),level:"info",prefix:r,stackInfo:t||void 0};this.handlers.forEach(e=>{try{e.handle("info",a,o,m)}catch(t){console.error("Log handler failed:",t)}})}trace(...e){this.log("debug",...e),this.shouldLog("debug")&&console.trace(...e)}critical(...e){this.log("critical",...e)}table(o,t){if(!this.shouldLog("info"))return;const r=this.getEffectivePrefix(),n=e.StylePresets.accent().build(),a="%c๐Ÿ“Š TABLE"+(r?` [${r}]`:"");console.log(a,n),t?console.table(o,t):console.table(o)}group(o,t=!1){const r=(new e.StyleBuilder).bg("linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%)").color("#1565c0").border("1px solid #90caf9").padding("4px 12px").rounded("6px").bold().build(),n=`%c๐Ÿ“ ${o}`;t?console.groupCollapsed(n,r):console.group(n,r),this.groupDepth++}groupEnd(){this.groupDepth>0&&(console.groupEnd(),this.groupDepth--)}time(o){const t={label:o,startTime:performance.now()};this.timers.set(o,t);const r=e.StylePresets.warning().build();console.log(`%cโฑ๏ธ Timer started: ${o}`,r)}timeEnd(o){const t=this.timers.get(o);if(!t)return void this.warn(`Timer '${o}' does not exist`);const r=performance.now()-t.startTime;this.timers.delete(o);const n=e.StylePresets.success().build();console.log(`%cโฑ๏ธ Timer ended: ${o} - ${r.toFixed(2)}ms`,n)}showBanner(e){displayInitBanner(e||this.config.bannerType)}logWithSVG(o,t,r={}){const{width:n=300,height:a=60,padding:i="30px 150px"}=r;let s="";s=t?`data:image/svg+xml,${encodeURIComponent(t)}`:`data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 ${n} ${a}'><defs><linearGradient id='grad' x1='0%' y1='0%' x2='100%' y2='0%'><stop offset='0%' style='stop-color:%23667eea'/><stop offset='100%' style='stop-color:%23764ba2'/></linearGradient></defs><rect width='100%' height='100%' fill='url(%23grad)' rx='4'/><text x='${n/2}' y='${a/2+5}' text-anchor='middle' fill='white' font-family='monospace' font-size='14' font-weight='bold'>${o}</text></svg>`)}`;const l=(new e.StyleBuilder).bg(`url("${s}") no-repeat center center`).padding(i).color("transparent").rounded("4px").build();console.log(`%c${o}`,l)}logAnimated(o,t=3){if(!document.getElementById("logger-animations")){const e=document.createElement("style");e.id="logger-animations",e.textContent="\n @keyframes loggerGradient {\n 0% { background-position: 0% 50%; }\n 50% { background-position: 100% 50%; }\n 100% { background-position: 0% 50%; }\n }\n ",document.head.appendChild(e)}const r=(new e.StyleBuilder).bg("linear-gradient(-45deg, #667eea, #764ba2, #667eea, #764ba2)").css("background-size","400% 400%").color("#ffffff").padding("12px 20px").rounded("8px").bold().font("Monaco, Consolas, monospace").animation(`loggerGradient ${t}s ease infinite`).display("inline-block").build();console.log(`%c${o}`,r)}logGrouped(e,o){try{let t;t=Object.groupBy?Object.groupBy(e,o):e.reduce((e,t)=>{const r=o(t);return e[r]||(e[r]=[]),e[r].push(t),e},{}),Object.entries(t).forEach(([e,o])=>{this.group(`Group: ${e}`),this.table(o),this.groupEnd()})}catch{this.info("Grouped data:",e)}}async cli(e){this.cliProcessor?await this.cliProcessor.processCommand(e,this):this.error("CLI processor not initialized")}}new Logger({verbosity:"info",enableColors:!0,enableTimestamps:!0,enableStackTrace:!0,bufferSize:1e3}),displayInitBanner(),exports.BANNER_VARIANTS=t,exports.ExportLogHandler=ExportLogHandler,exports.Logger=Logger,exports.THEME_BANNERS=r,exports.THEME_PRESETS=o,exports.displayInitBanner=displayInitBanner;
2
+ //# sourceMappingURL=Logger-C2-cR3No.js.map