@mks2508/better-logger 0.14.0-alpha.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/.claude/settings.local.json +2 -1
  2. package/dist/Logger.d.ts +12 -16
  3. package/dist/Logger.d.ts.map +1 -1
  4. package/dist/ScopedLogger.d.ts +1 -9
  5. package/dist/chunks/{Logger-D_p3xnbq.js → Logger-C9zTFYBh.js} +2 -2
  6. package/dist/chunks/Logger-C9zTFYBh.js.map +1 -0
  7. package/dist/chunks/{Logger-Crw1woqR.js → Logger-Th9SfADL.js} +50 -17
  8. package/dist/chunks/Logger-Th9SfADL.js.map +1 -0
  9. package/dist/chunks/ScopedLogger-HgV_J-ug.js +2 -0
  10. package/dist/chunks/ScopedLogger-HgV_J-ug.js.map +1 -0
  11. package/dist/chunks/ScopedLogger-uAAeJkfA.js +361 -0
  12. package/dist/chunks/ScopedLogger-uAAeJkfA.js.map +1 -0
  13. package/dist/chunks/environment-5I5unY89.js +4 -0
  14. package/dist/chunks/environment-5I5unY89.js.map +1 -0
  15. package/dist/chunks/{environment-Bxbnw4pd.js → environment-wXLQvk5g.js} +103 -11
  16. package/dist/chunks/environment-wXLQvk5g.js.map +1 -0
  17. package/dist/chunks/formatting-CiFnwe1I.js +2 -0
  18. package/dist/chunks/formatting-CiFnwe1I.js.map +1 -0
  19. package/dist/chunks/formatting-DIhpRCCk.js +380 -0
  20. package/dist/chunks/formatting-DIhpRCCk.js.map +1 -0
  21. package/dist/cli/CommandProcessor.d.ts +1 -4
  22. package/dist/cli/commands/ConfigCommand.d.ts +2 -5
  23. package/dist/cli/commands/ExportCommand.d.ts +2 -5
  24. package/dist/cli/commands/HistoryCommand.d.ts +2 -5
  25. package/dist/cli/commands/StatusCommand.d.ts +2 -5
  26. package/dist/cli/commands/ThemeCommand.d.ts +2 -5
  27. package/dist/cli/help.d.ts +2 -5
  28. package/dist/cli/index.d.ts +1 -1
  29. package/dist/constants.d.ts +110 -5
  30. package/dist/constants.d.ts.map +1 -1
  31. package/dist/core.cjs +1 -1
  32. package/dist/core.cjs.map +1 -1
  33. package/dist/core.d.ts +1 -8
  34. package/dist/core.d.ts.map +1 -1
  35. package/dist/core.js +281 -307
  36. package/dist/core.js.map +1 -1
  37. package/dist/exports-module.d.ts +1 -8
  38. package/dist/exports.cjs +1 -1
  39. package/dist/exports.js +2 -2
  40. package/dist/handlers/AnalyticsLogHandler.d.ts +1 -4
  41. package/dist/handlers/ExportLogHandler.d.ts +1 -4
  42. package/dist/handlers/ExportLogHandler.d.ts.map +1 -1
  43. package/dist/handlers/FileLogHandler.d.ts +1 -4
  44. package/dist/handlers/RemoteLogHandler.d.ts +1 -4
  45. package/dist/index.cjs +1 -1
  46. package/dist/index.cjs.map +1 -1
  47. package/dist/index.d.ts +8 -41
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +246 -159
  50. package/dist/index.js.map +1 -1
  51. package/dist/styling/LogStyleBuilder.d.ts +2 -5
  52. package/dist/styling/SemanticStyles.d.ts +0 -3
  53. package/dist/styling/SmartPresets.d.ts +1 -4
  54. package/dist/styling/banners.d.ts +1 -4
  55. package/dist/styling/themes.d.ts +2 -5
  56. package/dist/styling-module.d.ts +1 -8
  57. package/dist/styling.cjs +1 -1
  58. package/dist/styling.js +3 -3
  59. package/dist/types/core.d.ts +13 -0
  60. package/dist/types/core.d.ts.map +1 -1
  61. package/dist/types/handlers.d.ts +1 -4
  62. package/dist/types/index.d.ts +1 -1
  63. package/dist/types/index.d.ts.map +1 -1
  64. package/dist/utils/ansi-colors.d.ts +156 -0
  65. package/dist/utils/ansi-colors.d.ts.map +1 -0
  66. package/dist/utils/formatting.d.ts +20 -2
  67. package/dist/utils/formatting.d.ts.map +1 -1
  68. package/dist/utils/index.d.ts +1 -0
  69. package/dist/utils/index.d.ts.map +1 -1
  70. package/dist/utils/output.d.ts +1 -4
  71. package/dist/utils/stackTrace.d.ts +1 -4
  72. package/package.json +2 -1
  73. package/src/Logger.ts +102 -64
  74. package/src/constants.ts +131 -1
  75. package/src/core.ts +11 -7
  76. package/src/handlers/ExportLogHandler.ts +2 -1
  77. package/src/index.ts +62 -27
  78. package/src/styling/SemanticStyles.ts +1 -1
  79. package/src/types/core.ts +15 -1
  80. package/src/types/index.ts +1 -0
  81. package/src/utils/ansi-colors.ts +333 -0
  82. package/src/utils/formatting.ts +196 -6
  83. package/src/utils/index.ts +23 -11
  84. package/vite.config.ts +1 -1
  85. package/dist/.tsbuildinfo +0 -1
  86. package/dist/Logger.js +0 -1124
  87. package/dist/ScopedLogger.js +0 -426
  88. package/dist/chunks/Logger-Crw1woqR.js.map +0 -1
  89. package/dist/chunks/Logger-D_p3xnbq.js.map +0 -1
  90. package/dist/chunks/environment-Bxbnw4pd.js.map +0 -1
  91. package/dist/chunks/environment-Dm66zOML.js +0 -4
  92. package/dist/chunks/environment-Dm66zOML.js.map +0 -1
  93. package/dist/chunks/formatting-C0riPC5_.js +0 -95
  94. package/dist/chunks/formatting-C0riPC5_.js.map +0 -1
  95. package/dist/chunks/formatting-DNCAV66-.js +0 -2
  96. package/dist/chunks/formatting-DNCAV66-.js.map +0 -1
  97. package/dist/cli/CommandProcessor.js +0 -184
  98. package/dist/cli/commands/ConfigCommand.js +0 -88
  99. package/dist/cli/commands/ExportCommand.js +0 -243
  100. package/dist/cli/commands/HistoryCommand.js +0 -96
  101. package/dist/cli/commands/StatusCommand.js +0 -93
  102. package/dist/cli/commands/ThemeCommand.js +0 -79
  103. package/dist/cli/help.js +0 -118
  104. package/dist/cli/index.js +0 -46
  105. package/dist/constants.js +0 -159
  106. package/dist/example.js +0 -154
  107. package/dist/exports-module.js +0 -260
  108. package/dist/handlers/AnalyticsLogHandler.js +0 -19
  109. package/dist/handlers/ExportLogHandler.js +0 -516
  110. package/dist/handlers/FileLogHandler.js +0 -156
  111. package/dist/handlers/RemoteLogHandler.js +0 -37
  112. package/dist/handlers/index.js +0 -7
  113. package/dist/main.js +0 -139
  114. package/dist/styling/LogStyleBuilder.js +0 -289
  115. package/dist/styling/SemanticStyles.js +0 -339
  116. package/dist/styling/SmartPresets.js +0 -276
  117. package/dist/styling/StyleBuilder.js +0 -280
  118. package/dist/styling/banners.js +0 -155
  119. package/dist/styling/index.js +0 -9
  120. package/dist/styling/themes.js +0 -231
  121. package/dist/styling-module.js +0 -199
  122. package/dist/types/Logger.d.ts +0 -700
  123. package/dist/types/Logger.d.ts.map +0 -1
  124. package/dist/types/ScopedLogger.d.ts +0 -310
  125. package/dist/types/ScopedLogger.d.ts.map +0 -1
  126. package/dist/types/cli/CommandProcessor.d.ts +0 -100
  127. package/dist/types/cli/CommandProcessor.d.ts.map +0 -1
  128. package/dist/types/cli/commands/ConfigCommand.d.ts +0 -14
  129. package/dist/types/cli/commands/ConfigCommand.d.ts.map +0 -1
  130. package/dist/types/cli/commands/ExportCommand.d.ts +0 -48
  131. package/dist/types/cli/commands/ExportCommand.d.ts.map +0 -1
  132. package/dist/types/cli/commands/HistoryCommand.d.ts +0 -47
  133. package/dist/types/cli/commands/HistoryCommand.d.ts.map +0 -1
  134. package/dist/types/cli/commands/StatusCommand.d.ts +0 -30
  135. package/dist/types/cli/commands/StatusCommand.d.ts.map +0 -1
  136. package/dist/types/cli/commands/ThemeCommand.d.ts +0 -30
  137. package/dist/types/cli/commands/ThemeCommand.d.ts.map +0 -1
  138. package/dist/types/cli/help.d.ts +0 -12
  139. package/dist/types/cli/help.d.ts.map +0 -1
  140. package/dist/types/cli/index.d.ts +0 -15
  141. package/dist/types/cli/index.d.ts.map +0 -1
  142. package/dist/types/constants.d.ts +0 -119
  143. package/dist/types/constants.d.ts.map +0 -1
  144. package/dist/types/core.js +0 -28
  145. package/dist/types/example.d.ts +0 -18
  146. package/dist/types/example.d.ts.map +0 -1
  147. package/dist/types/exports-module.d.ts +0 -196
  148. package/dist/types/exports-module.d.ts.map +0 -1
  149. package/dist/types/handlers/AnalyticsLogHandler.d.ts +0 -8
  150. package/dist/types/handlers/AnalyticsLogHandler.d.ts.map +0 -1
  151. package/dist/types/handlers/ExportLogHandler.d.ts +0 -100
  152. package/dist/types/handlers/ExportLogHandler.d.ts.map +0 -1
  153. package/dist/types/handlers/FileLogHandler.d.ts +0 -33
  154. package/dist/types/handlers/FileLogHandler.d.ts.map +0 -1
  155. package/dist/types/handlers/RemoteLogHandler.d.ts +0 -11
  156. package/dist/types/handlers/RemoteLogHandler.d.ts.map +0 -1
  157. package/dist/types/handlers/index.d.ts +0 -8
  158. package/dist/types/handlers/index.d.ts.map +0 -1
  159. package/dist/types/handlers.js +0 -4
  160. package/dist/types/index.js +0 -4
  161. package/dist/types/main.d.ts +0 -2
  162. package/dist/types/main.d.ts.map +0 -1
  163. package/dist/types/styling/LogStyleBuilder.d.ts +0 -146
  164. package/dist/types/styling/LogStyleBuilder.d.ts.map +0 -1
  165. package/dist/types/styling/SemanticStyles.d.ts +0 -178
  166. package/dist/types/styling/SemanticStyles.d.ts.map +0 -1
  167. package/dist/types/styling/SmartPresets.d.ts +0 -22
  168. package/dist/types/styling/SmartPresets.d.ts.map +0 -1
  169. package/dist/types/styling/StyleBuilder.d.ts +0 -140
  170. package/dist/types/styling/StyleBuilder.d.ts.map +0 -1
  171. package/dist/types/styling/banners.d.ts +0 -42
  172. package/dist/types/styling/banners.d.ts.map +0 -1
  173. package/dist/types/styling/index.d.ts +0 -10
  174. package/dist/types/styling/index.d.ts.map +0 -1
  175. package/dist/types/styling/themes.d.ts +0 -7
  176. package/dist/types/styling/themes.d.ts.map +0 -1
  177. package/dist/types/styling-module.d.ts +0 -178
  178. package/dist/types/styling-module.d.ts.map +0 -1
  179. package/dist/types/types/core.d.ts +0 -221
  180. package/dist/types/types/core.d.ts.map +0 -1
  181. package/dist/types/types/handlers.d.ts +0 -85
  182. package/dist/types/types/handlers.d.ts.map +0 -1
  183. package/dist/types/types/index.d.ts +0 -7
  184. package/dist/types/types/index.d.ts.map +0 -1
  185. package/dist/types/utils/environment.d.ts +0 -47
  186. package/dist/types/utils/environment.d.ts.map +0 -1
  187. package/dist/types/utils/formatting.d.ts +0 -37
  188. package/dist/types/utils/formatting.d.ts.map +0 -1
  189. package/dist/types/utils/index.d.ts +0 -7
  190. package/dist/types/utils/index.d.ts.map +0 -1
  191. package/dist/types/utils/opentui-detection.d.ts +0 -34
  192. package/dist/types/utils/opentui-detection.d.ts.map +0 -1
  193. package/dist/types/utils/output.d.ts +0 -41
  194. package/dist/types/utils/output.d.ts.map +0 -1
  195. package/dist/types/utils/stackTrace.d.ts +0 -6
  196. package/dist/types/utils/stackTrace.d.ts.map +0 -1
  197. package/dist/types/utils/timestamps.d.ts +0 -20
  198. package/dist/types/utils/timestamps.d.ts.map +0 -1
  199. package/dist/utils/environment.js +0 -85
  200. package/dist/utils/formatting.js +0 -117
  201. package/dist/utils/index.js +0 -6
  202. package/dist/utils/opentui-detection.js +0 -116
  203. package/dist/utils/output.js +0 -150
  204. package/dist/utils/stackTrace.js +0 -81
  205. package/dist/utils/timestamps.js +0 -71
@@ -1,243 +0,0 @@
1
- /**
2
- * @fileoverview Export and clipboard commands for Advanced Logger CLI
3
- */
4
- import { EXPORT_FORMATS } from '../../constants.js';
5
- /**
6
- * Parse command line arguments into filters and options
7
- */
8
- function parseArguments(args) {
9
- const filters = {};
10
- const options = {};
11
- let format;
12
- if (!args.trim())
13
- return { filters, options };
14
- // Split args by spaces, but keep quoted strings together
15
- const argParts = args.match(/(?:[^\s"]+|"[^"]*")+/g) || [];
16
- for (let i = 0; i < argParts.length; i++) {
17
- const arg = argParts[i];
18
- // Skip if arg is null/undefined
19
- if (!arg) {
20
- continue;
21
- }
22
- // Format (first argument without --)
23
- if (i === 0 && !arg.startsWith('--') && arg in EXPORT_FORMATS) {
24
- format = arg;
25
- continue;
26
- }
27
- // Parse --flags
28
- if (arg.startsWith('--')) {
29
- const [flag, value] = arg.slice(2).split('=');
30
- switch (flag) {
31
- case 'level':
32
- case 'levels':
33
- if (value) {
34
- filters.levels = value.split(',').map(l => l.trim());
35
- }
36
- break;
37
- case 'since':
38
- if (value)
39
- filters.since = value;
40
- break;
41
- case 'until':
42
- if (value)
43
- filters.until = value;
44
- break;
45
- case 'prefix':
46
- case 'prefixes':
47
- if (value) {
48
- filters.prefixes = value.split(',').map(p => p.trim());
49
- }
50
- break;
51
- case 'exclude-prefix':
52
- case 'exclude-prefixes':
53
- if (value) {
54
- filters.excludePrefixes = value.split(',').map(p => p.trim());
55
- }
56
- break;
57
- case 'last':
58
- if (value)
59
- filters.last = parseInt(value, 10);
60
- break;
61
- case 'first':
62
- if (value)
63
- filters.first = parseInt(value, 10);
64
- break;
65
- case 'search':
66
- if (value)
67
- filters.search = value.replace(/['"]/g, '');
68
- break;
69
- case 'with-stack':
70
- filters.withStackTrace = true;
71
- break;
72
- case 'errors-only':
73
- filters.errorsOnly = true;
74
- break;
75
- case 'group-by':
76
- if (value) {
77
- filters.groupBy = value;
78
- options.groupBy = value;
79
- }
80
- break;
81
- case 'minimal':
82
- options.minimal = true;
83
- break;
84
- case 'compact':
85
- options.compact = true;
86
- break;
87
- case 'styled':
88
- options.styled = true;
89
- break;
90
- }
91
- }
92
- }
93
- return { filters, options, format };
94
- }
95
- /**
96
- * Export command - export logs in various formats
97
- */
98
- export class ExportCommand {
99
- name = 'export';
100
- description = 'Export logs to various formats';
101
- usage = '/export <format> [--filter=value] [--option]';
102
- execute(args, logger) {
103
- const exportHandler = logger.getExportHandler();
104
- if (!exportHandler) {
105
- logger.error('Export handler not available. Make sure ExportLogHandler is registered.');
106
- return;
107
- }
108
- const { filters, options, format } = parseArguments(args);
109
- if (!format) {
110
- logger.error('Format required. Available formats: ' + Object.keys(EXPORT_FORMATS).join(', '));
111
- logger.info('Usage: /export <format> [--filter=value]');
112
- logger.info('Example: /export json --level=error,warn --last=50');
113
- return;
114
- }
115
- try {
116
- const result = exportHandler.export(format, filters, options);
117
- // Log success with metadata
118
- logger.success(`✅ Export completed: ${result.metadata.filteredLogs} logs exported in ${format} format`);
119
- // Show preview for small exports
120
- if (result.data.length < 1000) {
121
- logger.group(`📄 Preview (${format.toUpperCase()})`);
122
- console.log(result.data);
123
- logger.groupEnd();
124
- }
125
- else {
126
- logger.info(`📄 Export size: ${(result.data.length / 1024).toFixed(2)}KB`);
127
- }
128
- // Show metadata
129
- logger.table({
130
- format: result.format,
131
- totalLogs: result.metadata.totalLogs,
132
- filtered: result.metadata.filteredLogs,
133
- exported: result.metadata.exportedAt
134
- });
135
- }
136
- catch (error) {
137
- logger.error('Export failed:', error);
138
- }
139
- }
140
- }
141
- /**
142
- * Copy command - copy logs to clipboard
143
- */
144
- export class CopyCommand {
145
- name = 'copy';
146
- description = 'Copy logs to clipboard';
147
- usage = '/copy <format> [--filter=value] [--option]';
148
- async execute(args, logger) {
149
- const exportHandler = logger.getExportHandler();
150
- if (!exportHandler) {
151
- logger.error('Export handler not available. Make sure ExportLogHandler is registered.');
152
- return;
153
- }
154
- const { filters, options, format } = parseArguments(args);
155
- if (!format) {
156
- logger.error('Format required. Available formats: ' + Object.keys(EXPORT_FORMATS).join(', '));
157
- logger.info('Usage: /copy <format> [--filter=value]');
158
- logger.info('Example: /copy plain --level=error --last=25');
159
- return;
160
- }
161
- try {
162
- const success = await exportHandler.copyToClipboard(format, filters, options);
163
- if (success) {
164
- const result = exportHandler.export(format, filters, options);
165
- logger.success(`📋 Copied ${result.metadata.filteredLogs} logs to clipboard (${format} format)`);
166
- }
167
- else {
168
- logger.error('Failed to copy to clipboard. Browser may not support clipboard API.');
169
- }
170
- }
171
- catch (error) {
172
- logger.error('Copy failed:', error);
173
- }
174
- }
175
- }
176
- /**
177
- * Buffer-size command - configure buffer size
178
- */
179
- export class BufferSizeCommand {
180
- name = 'buffer-size';
181
- description = 'Set log buffer size';
182
- usage = '/buffer-size <size>';
183
- execute(args, logger) {
184
- const exportHandler = logger.getExportHandler();
185
- if (!exportHandler) {
186
- logger.error('Export handler not available.');
187
- return;
188
- }
189
- const size = parseInt(args.trim(), 10);
190
- if (isNaN(size) || size <= 0) {
191
- logger.error('Invalid buffer size. Must be a positive number.');
192
- logger.info('Example: /buffer-size 2000');
193
- return;
194
- }
195
- exportHandler.setBufferSize(size);
196
- logger.success(`Buffer size set to ${size}`);
197
- }
198
- }
199
- /**
200
- * Clear-buffer command - clear log buffer
201
- */
202
- export class ClearBufferCommand {
203
- name = 'clear-buffer';
204
- description = 'Clear the log buffer';
205
- usage = '/clear-buffer';
206
- execute(_args, logger) {
207
- const exportHandler = logger.getExportHandler();
208
- if (!exportHandler) {
209
- logger.error('Export handler not available.');
210
- return;
211
- }
212
- const stats = exportHandler.getBufferStats();
213
- exportHandler.clearBuffer();
214
- logger.success(`✅ Buffer cleared. Removed ${stats.size} log entries.`);
215
- }
216
- }
217
- /**
218
- * Buffer-info command - show buffer information
219
- */
220
- export class BufferInfoCommand {
221
- name = 'buffer-info';
222
- description = 'Show buffer statistics and information';
223
- usage = '/buffer-info';
224
- execute(_args, logger) {
225
- const exportHandler = logger.getExportHandler();
226
- if (!exportHandler) {
227
- logger.error('Export handler not available.');
228
- return;
229
- }
230
- const stats = exportHandler.getBufferStats();
231
- logger.group('📊 Buffer Information');
232
- logger.table({
233
- size: `${stats.size}/${stats.maxSize}`,
234
- usage: `${stats.usage.toFixed(1)}%`,
235
- oldestLog: stats.oldestLog?.toLocaleString() || 'None',
236
- newestLog: stats.newestLog?.toLocaleString() || 'None'
237
- });
238
- logger.group('📈 Log Level Counts');
239
- logger.table(stats.levelCounts);
240
- logger.groupEnd();
241
- logger.groupEnd();
242
- }
243
- }
@@ -1,96 +0,0 @@
1
- /**
2
- * @fileoverview History management commands for CLI
3
- */
4
- /**
5
- * Show command history
6
- */
7
- export class HistoryCommand {
8
- name = 'history';
9
- description = 'Show command execution history';
10
- usage = '/history [limit] - Show recent commands (default: 10)';
11
- category = 'system';
12
- aliases = ['hist', 'h'];
13
- execute(args, logger) {
14
- const processor = logger.cliProcessor;
15
- if (!processor) {
16
- logger.error('CLI processor not available');
17
- return;
18
- }
19
- const limit = parseInt(args) || 10;
20
- const history = processor.getHistory().slice(0, limit);
21
- if (history.length === 0) {
22
- logger.info('📝 No command history available');
23
- return;
24
- }
25
- logger.info(`📋 Last ${history.length} commands:`);
26
- history.forEach((entry, index) => {
27
- const status = entry.success ? '✅' : '❌';
28
- const time = entry.timestamp.toLocaleTimeString();
29
- logger.info(`${status} [${time}] ${entry.command}`);
30
- });
31
- }
32
- }
33
- /**
34
- * Clear command history
35
- */
36
- export class ClearHistoryCommand {
37
- name = 'clearhistory';
38
- description = 'Clear command execution history';
39
- usage = '/clearhistory - Remove all command history';
40
- category = 'system';
41
- aliases = ['clrhist'];
42
- execute(args, logger) {
43
- const processor = logger.cliProcessor;
44
- if (!processor) {
45
- logger.error('CLI processor not available');
46
- return;
47
- }
48
- processor.clearHistory();
49
- logger.success('🗑️ Command history cleared');
50
- }
51
- }
52
- /**
53
- * Interactive mode command
54
- */
55
- export class InteractiveCommand {
56
- name = 'interactive';
57
- description = 'Enter interactive CLI mode';
58
- usage = '/interactive - Start interactive command mode';
59
- category = 'system';
60
- aliases = ['i', 'repl'];
61
- execute(args, logger) {
62
- const processor = logger.cliProcessor;
63
- if (!processor) {
64
- logger.error('CLI processor not available');
65
- return;
66
- }
67
- processor.enterInteractiveMode(logger);
68
- }
69
- }
70
- /**
71
- * Plugin management command
72
- */
73
- export class PluginsCommand {
74
- name = 'plugins';
75
- description = 'List loaded CLI plugins';
76
- usage = '/plugins - Show all registered plugins';
77
- category = 'system';
78
- aliases = ['plug'];
79
- execute(args, logger) {
80
- const processor = logger.cliProcessor;
81
- if (!processor) {
82
- logger.error('CLI processor not available');
83
- return;
84
- }
85
- const plugins = processor.getPlugins();
86
- if (plugins.length === 0) {
87
- logger.info('🔌 No plugins registered');
88
- return;
89
- }
90
- logger.info(`🔌 Loaded plugins (${plugins.length}):`);
91
- plugins.forEach((plugin) => {
92
- logger.info(` 📦 ${plugin.name} v${plugin.version} - ${plugin.description}`);
93
- logger.info(` Commands: ${plugin.commands.map((c) => c.name).join(', ')}`);
94
- });
95
- }
96
- }
@@ -1,93 +0,0 @@
1
- /**
2
- * @fileoverview Status and demo commands for Advanced Logger CLI
3
- */
4
- /**
5
- * Status command - show logger configuration and statistics
6
- */
7
- export class StatusCommand {
8
- name = 'status';
9
- description = 'Show current logger status and configuration';
10
- usage = '/status';
11
- execute(_args, logger) {
12
- const config = logger.getConfig();
13
- const statusData = {
14
- theme: config.theme ? config.theme : 'default',
15
- verbosity: config.verbosity,
16
- colors: config.enableColors,
17
- timestamps: config.enableTimestamps,
18
- stackTrace: config.enableStackTrace,
19
- globalPrefix: config.globalPrefix ? config.globalPrefix : 'none',
20
- bannerType: config.bannerType ? config.bannerType : 'simple',
21
- handlers: logger.getHandlers().length,
22
- bufferSize: config.bufferSize ? config.bufferSize : 1000
23
- };
24
- logger.group('⚙️ Logger Configuration');
25
- logger.table(statusData);
26
- logger.groupEnd();
27
- // Show buffer stats if ExportLogHandler is present
28
- const exportHandler = logger.getExportHandler();
29
- if (exportHandler) {
30
- const bufferStats = exportHandler.getBufferStats();
31
- logger.group('📊 Buffer Statistics');
32
- logger.table({
33
- size: `${bufferStats.size}/${bufferStats.maxSize}`,
34
- usage: `${bufferStats.usage.toFixed(1)}%`,
35
- oldestLog: bufferStats.oldestLog ? bufferStats.oldestLog.toISOString() : 'None',
36
- newestLog: bufferStats.newestLog ? bufferStats.newestLog.toISOString() : 'None',
37
- errorCount: bufferStats.levelCounts.error + bufferStats.levelCounts.critical,
38
- warningCount: bufferStats.levelCounts.warn
39
- });
40
- logger.groupEnd();
41
- }
42
- }
43
- }
44
- /**
45
- * Reset command - reset logger to defaults
46
- */
47
- export class ResetCommand {
48
- name = 'reset';
49
- description = 'Reset logger configuration to defaults';
50
- usage = '/reset';
51
- execute(_args, logger) {
52
- logger.resetConfig();
53
- }
54
- }
55
- /**
56
- * Demo command - show logger feature demonstration
57
- */
58
- export class DemoCommand {
59
- name = 'demo';
60
- description = 'Show comprehensive feature demonstration';
61
- usage = '/demo';
62
- execute(_args, logger) {
63
- logger.group('🎪 Advanced Logger Demo');
64
- // Basic logging demo
65
- logger.debug('Debug message with detailed information');
66
- logger.info('Informational message about system state');
67
- logger.warn('Warning about deprecated feature');
68
- logger.error('Error processing user request');
69
- logger.success('Operation completed successfully');
70
- logger.critical('Critical system failure detected');
71
- // Advanced features demo
72
- logger.group('📊 Advanced Features Demo');
73
- // Table demo
74
- logger.table([
75
- { feature: 'Styled Console', status: '✅ Active', performance: 'Excellent' },
76
- { feature: 'Theme System', status: '✅ Active', performance: 'Great' },
77
- { feature: 'CLI Interface', status: '✅ Active', performance: 'Good' },
78
- { feature: 'Export System', status: '✅ Active', performance: 'Excellent' }
79
- ]);
80
- // Timer demo
81
- logger.time('demo-operation');
82
- setTimeout(() => {
83
- logger.timeEnd('demo-operation');
84
- }, 100);
85
- // SVG demo
86
- logger.logWithSVG('SVG Demo');
87
- // Animated demo
88
- logger.logAnimated('🌟 Animated Logger Demo 🌟', 2);
89
- logger.groupEnd();
90
- logger.groupEnd();
91
- logger.info('Demo completed! Check the console for styled output.');
92
- }
93
- }
@@ -1,79 +0,0 @@
1
- /**
2
- * @fileoverview Theme and banner commands for Advanced Logger CLI
3
- */
4
- import { THEME_PRESETS, BANNER_VARIANTS } from '../../styling/index.js';
5
- import { StyleBuilder } from '../../styling/index.js';
6
- /**
7
- * Themes command - show available themes
8
- */
9
- export class ThemesCommand {
10
- name = 'themes';
11
- description = 'Show available theme presets';
12
- usage = '/themes';
13
- execute(_args, logger) {
14
- logger.group('🎨 Available Themes');
15
- Object.keys(THEME_PRESETS).forEach(themeName => {
16
- const preview = THEME_PRESETS[themeName];
17
- const previewStyle = new StyleBuilder()
18
- .bg(preview.info.background)
19
- .color(preview.info.color)
20
- .padding('4px 8px')
21
- .rounded('4px')
22
- .border(preview.info.border)
23
- .build();
24
- console.log(`%c${themeName}`, previewStyle, `- ${themeName} theme preview`);
25
- });
26
- logger.groupEnd();
27
- }
28
- }
29
- /**
30
- * Banners command - show available banner types
31
- */
32
- export class BannersCommand {
33
- name = 'banners';
34
- description = 'Show available banner types';
35
- usage = '/banners';
36
- execute(_args, logger) {
37
- logger.group('🖼️ Available Banner Types');
38
- Object.keys(BANNER_VARIANTS).forEach(bannerName => {
39
- const banner = BANNER_VARIANTS[bannerName];
40
- console.log(`%c${bannerName}`, 'font-weight: bold; color: #667eea;');
41
- console.log(`%cPreview:`, 'color: #666; font-size: 12px;');
42
- // Show a mini preview
43
- if (bannerName === 'simple') {
44
- console.log(`%c${banner.text}`, banner.style);
45
- }
46
- else if (bannerName === 'ascii') {
47
- console.log(`%c${banner.text.split('\n').slice(1, 4).join('\n')}...`, 'font-family: monospace; color: #667eea; font-size: 10px;');
48
- }
49
- else if (bannerName === 'unicode') {
50
- console.log(`%c${banner.text}`, banner.style);
51
- }
52
- else {
53
- console.log(`%c${bannerName} banner`, 'color: #666; font-style: italic;');
54
- }
55
- });
56
- logger.groupEnd();
57
- }
58
- }
59
- /**
60
- * Banner command - change/show banner type
61
- */
62
- export class BannerCommand {
63
- name = 'banner';
64
- description = 'Change or show current banner type';
65
- usage = '/banner [type]';
66
- execute(args, logger) {
67
- if (!args) {
68
- logger.showBanner();
69
- return;
70
- }
71
- if (args in BANNER_VARIANTS) {
72
- logger.setBannerType(args);
73
- logger.showBanner();
74
- }
75
- else {
76
- logger.error(`Invalid banner type: ${args}. Available: ${Object.keys(BANNER_VARIANTS).join(', ')}`);
77
- }
78
- }
79
- }
package/dist/cli/help.js DELETED
@@ -1,118 +0,0 @@
1
- /**
2
- * @fileoverview Help system for Advanced Logger CLI
3
- */
4
- import { StyleBuilder } from '../styling/index.js';
5
- /**
6
- * Help command - show comprehensive CLI help
7
- */
8
- export class HelpCommand {
9
- name = 'help';
10
- description = 'Show CLI help and available commands';
11
- usage = '/help [command]';
12
- execute(_args, logger) {
13
- const helpStyle = new StyleBuilder()
14
- .bg('linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%)')
15
- .color('#495057')
16
- .padding('15px 20px')
17
- .rounded('8px')
18
- .border('1px solid #dee2e6')
19
- .font('Monaco, Consolas, monospace')
20
- .size('13px')
21
- .build();
22
- const helpText = `
23
- ╭─────────────── ADVANCED LOGGER CLI COMMANDS ─────────────────╮
24
- │ │
25
- │ CONFIGURATION │
26
- │ /config Show current configuration │
27
- │ /config {json} Apply JSON configuration │
28
- │ /config key=val Apply key-value configuration │
29
- │ /themes Show available themes │
30
- │ /banners Show available banner types │
31
- │ /banner [type] Change/show banner type │
32
- │ /status Show logger status & buffer stats │
33
- │ /demo Show feature demonstration │
34
- │ /reset Reset to default configuration │
35
- │ │
36
- │ EXPORT & CLIPBOARD │
37
- │ /export <format> Export logs (json|csv|md|plain|html) │
38
- │ /copy <format> Copy logs to clipboard │
39
- │ /buffer-size N Set log buffer size │
40
- │ /buffer-info Show buffer statistics │
41
- │ /clear-buffer Clear stored logs │
42
- │ │
43
- │ EXPORT FILTERS (for export/copy commands) │
44
- │ --level error,warn Filter by log levels │
45
- │ --since 2h Logs from last 2 hours │
46
- │ --until 1h Logs until 1 hour ago │
47
- │ --prefix API,DB Filter by prefixes │
48
- │ --exclude-prefix INT Exclude prefixes │
49
- │ --last 50 Last 50 logs only │
50
- │ --first 25 First 25 logs only │
51
- │ --search "error" Search in log messages │
52
- │ --with-stack Only logs with stack traces │
53
- │ --errors-only Only error + critical logs │
54
- │ --group-by level Group by level/prefix/hour │
55
- │ │
56
- │ EXPORT OPTIONS │
57
- │ --minimal Minimal output format │
58
- │ --compact Remove extra whitespace │
59
- │ --styled Include styling (HTML format) │
60
- │ │
61
- ├──────────────────── CONFIGURATION OPTIONS ─────────────────┤
62
- │ │
63
- │ theme: default | dark | light | neon | minimal | cyberpunk│
64
- │ bannerType: simple | ascii | unicode | svg | animated │
65
- │ verbosity: debug | info | warn | error | critical | silent│
66
- │ enableColors: true | false │
67
- │ enableTimestamps: true | false │
68
- │ enableStackTrace: true | false │
69
- │ globalPrefix: "string" │
70
- │ bufferSize: number (50-10000) │
71
- │ │
72
- ├──────────────────────── EXAMPLES ──────────────────────────┤
73
- │ │
74
- │ Basic Configuration: │
75
- │ /config {"theme":"dark","verbosity":"debug"} │
76
- │ /config theme=neon,bufferSize=2000 │
77
- │ /banner animated Change to animated banner │
78
- │ │
79
- │ Export Examples: │
80
- │ /export json --level=error,warn --last=25 │
81
- │ /export csv --since=2h --prefix=API │
82
- │ /export markdown --group-by=level --errors-only │
83
- │ /export html --styled --since=1h │
84
- │ │
85
- │ Clipboard Examples: │
86
- │ /copy plain --minimal --last=10 │
87
- │ /copy json --search="authentication" --compact │
88
- │ /copy csv --since=30m --exclude-prefix=DEBUG │
89
- │ │
90
- │ Buffer Management: │
91
- │ /buffer-size 5000 Increase buffer to 5000 logs │
92
- │ /buffer-info Show detailed buffer statistics │
93
- │ /clear-buffer Clear all stored logs │
94
- │ │
95
- │ Time Formats: │
96
- │ --since=2h 2 hours ago │
97
- │ --since=30m 30 minutes ago │
98
- │ --since=1d 1 day ago │
99
- │ --since="2024-01-01T10:00:00Z" Specific ISO date │
100
- │ │
101
- ╰─────────────────────────────────────────────────────────────╯`;
102
- console.log(`%c${helpText}`, helpStyle);
103
- // Show quick tips
104
- logger.group('💡 Quick Tips');
105
- const tips = [
106
- 'Use /demo to see all logger features in action',
107
- 'Logs are automatically stored in a circular buffer for export',
108
- 'Export formats: JSON (structured), CSV (Excel), Markdown (readable), Plain (simple), HTML (styled)',
109
- 'Time filters support relative (2h, 30m) and absolute (ISO) formats',
110
- 'Combine multiple filters: /export json --level=error --since=1h --search="auth"',
111
- 'Use /copy for quick clipboard access instead of /export'
112
- ];
113
- tips.forEach(tip => {
114
- logger.info(`• ${tip}`);
115
- });
116
- logger.groupEnd();
117
- }
118
- }
package/dist/cli/index.js DELETED
@@ -1,46 +0,0 @@
1
- /**
2
- * @fileoverview CLI system exports for Advanced Logger
3
- */
4
- // Core CLI system
5
- export { CommandProcessor } from './CommandProcessor.js';
6
- import { CommandProcessor } from './CommandProcessor.js';
7
- // Commands
8
- export { ConfigCommand } from './commands/ConfigCommand.js';
9
- export { ThemesCommand, BannersCommand, BannerCommand } from './commands/ThemeCommand.js';
10
- export { StatusCommand, ResetCommand, DemoCommand } from './commands/StatusCommand.js';
11
- export { ExportCommand, CopyCommand, BufferSizeCommand, ClearBufferCommand, BufferInfoCommand } from './commands/ExportCommand.js';
12
- // Help system
13
- export { HelpCommand } from './help.js';
14
- // Import all commands
15
- import { HelpCommand } from './help.js';
16
- import { ConfigCommand } from './commands/ConfigCommand.js';
17
- import { ThemesCommand, BannersCommand, BannerCommand } from './commands/ThemeCommand.js';
18
- import { StatusCommand, ResetCommand, DemoCommand } from './commands/StatusCommand.js';
19
- import { ExportCommand, CopyCommand, BufferSizeCommand, ClearBufferCommand, BufferInfoCommand } from './commands/ExportCommand.js';
20
- import { HistoryCommand, ClearHistoryCommand, InteractiveCommand, PluginsCommand } from './commands/HistoryCommand.js';
21
- /**
22
- * Create and configure default CLI processor
23
- */
24
- export function createDefaultCLI() {
25
- const processor = new CommandProcessor();
26
- // Register all default commands
27
- processor.registerCommand(new HelpCommand());
28
- processor.registerCommand(new ConfigCommand());
29
- processor.registerCommand(new ThemesCommand());
30
- processor.registerCommand(new BannersCommand());
31
- processor.registerCommand(new BannerCommand());
32
- processor.registerCommand(new StatusCommand());
33
- processor.registerCommand(new ResetCommand());
34
- processor.registerCommand(new DemoCommand());
35
- processor.registerCommand(new ExportCommand());
36
- processor.registerCommand(new CopyCommand());
37
- processor.registerCommand(new BufferSizeCommand());
38
- processor.registerCommand(new ClearBufferCommand());
39
- processor.registerCommand(new BufferInfoCommand());
40
- // Register new enhanced commands
41
- processor.registerCommand(new HistoryCommand());
42
- processor.registerCommand(new ClearHistoryCommand());
43
- processor.registerCommand(new InteractiveCommand());
44
- processor.registerCommand(new PluginsCommand());
45
- return processor;
46
- }