@mks2508/better-logger 5.0.0 → 5.0.2
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.
- package/dist/chunks/{Logger-Cbi1f10o.js → Logger-CKqzXDh3.js} +2 -2
- package/dist/chunks/{Logger-Cbi1f10o.js.map → Logger-CKqzXDh3.js.map} +1 -1
- package/dist/chunks/{Logger-BZ7B7OXE.js → Logger-D_vuKP4l.js} +2 -2
- package/dist/chunks/{Logger-BZ7B7OXE.js.map → Logger-D_vuKP4l.js.map} +1 -1
- package/dist/chunks/cli-module-B-njrTWb.js +2 -0
- package/dist/chunks/cli-module-B-njrTWb.js.map +1 -0
- package/dist/chunks/{cli-module-ClIJmaT8.js → cli-module-Cx7qotPY.js} +16 -9
- package/dist/chunks/cli-module-Cx7qotPY.js.map +1 -0
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/exports.cjs +1 -1
- package/dist/exports.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/styling.cjs +1 -1
- package/dist/styling.js +2 -2
- package/dist/terminal/formatter.d.ts.map +1 -1
- package/package.json +5 -1
- package/.claude/settings.local.json +0 -48
- package/.github/workflows/ci-quality.yml +0 -357
- package/.github/workflows/docs-demo.yml +0 -119
- package/.github/workflows/releases-core.yml +0 -512
- package/.github/workflows/releases-full.yml +0 -582
- package/.github/workflows-backup/ci.yml +0 -221
- package/.github/workflows-backup/nightly.yml +0 -196
- package/.github/workflows-backup/release-optimized.yml +0 -373
- package/.github/workflows-backup/release.yml +0 -269
- package/.release-notes-0.2.0.md +0 -129
- package/.yamllint +0 -28
- package/CHANGELOG.json +0 -1076
- package/CHANGELOG.md +0 -209
- package/CLAUDE.md +0 -217
- package/bun.lock +0 -333
- package/demo.html +0 -847
- package/dist/chunks/cli-module-CadqgZ1Z.js +0 -2
- package/dist/chunks/cli-module-CadqgZ1Z.js.map +0 -1
- package/dist/chunks/cli-module-ClIJmaT8.js.map +0 -1
- package/docs/API.md +0 -918
- package/docs/CORE.md +0 -264
- package/docs/DEVELOPMENT.md +0 -731
- package/docs/EXPORTS.md +0 -467
- package/docs/PACKAGES.md +0 -244
- package/docs/STYLING.md +0 -405
- package/docs/_config.yml +0 -36
- package/docs/index.md +0 -179
- package/examples/README.md +0 -208
- package/examples/basic-logging.js +0 -75
- package/examples/data-export.js +0 -234
- package/examples/package.json +0 -16
- package/examples/performance-timing.js +0 -170
- package/examples/simplified-api.js +0 -124
- package/examples/styling-themes.js +0 -207
- package/index.html +0 -358
- package/packages/core/package.json +0 -57
- package/packages/exports/package.json +0 -41
- package/packages/nodejs-opentui/README.md +0 -232
- package/packages/nodejs-opentui/package.json +0 -72
- package/packages/nodejs-opentui/src/LogRenderer.ts +0 -171
- package/packages/nodejs-opentui/src/OpenTUILogHandler.ts +0 -178
- package/packages/nodejs-opentui/src/components/LogBadge.tsx +0 -131
- package/packages/nodejs-opentui/src/index.ts +0 -133
- package/packages/nodejs-opentui/src/types.ts +0 -158
- package/packages/nodejs-opentui/tsconfig.json +0 -20
- package/packages/styling/package.json +0 -41
- package/playground/demo-all.ts +0 -95
- package/playground/demo-box.ts +0 -85
- package/playground/demo-levels.ts +0 -56
- package/playground/demo-real-world.ts +0 -98
- package/playground/demo-spinner.ts +0 -77
- package/playground/demo-steps.ts +0 -72
- package/playground/demo-table.ts +0 -83
- package/project-utils/README.md +0 -172
- package/project-utils/auto-release-gemini.ts +0 -1193
- package/project-utils/auto-release-ui.ts +0 -1329
- package/project-utils/commit-generator.ts +0 -1385
- package/project-utils/commit-ui.ts +0 -264
- package/project-utils/git-utils.ts +0 -199
- package/project-utils/github-release-manager.ts +0 -466
- package/project-utils/project-config.ts +0 -260
- package/project-utils/prompt-templates.js +0 -345
- package/project-utils/prompt-templates.ts +0 -422
- package/project-utils/version-manager.ts +0 -1078
- package/public/vite.svg +0 -1
- package/src/Logger.ts +0 -1858
- package/src/ScopedLogger.ts +0 -256
- package/src/cli/CommandProcessor.ts +0 -248
- package/src/cli/commands/ConfigCommand.ts +0 -93
- package/src/cli/commands/ExportCommand.ts +0 -276
- package/src/cli/commands/HistoryCommand.ts +0 -117
- package/src/cli/commands/StatusCommand.ts +0 -112
- package/src/cli/commands/ThemeCommand.ts +0 -88
- package/src/cli/help.ts +0 -127
- package/src/cli/index.ts +0 -71
- package/src/cli-module.ts +0 -21
- package/src/cli-primitives/box.ts +0 -86
- package/src/cli-primitives/cli-table.ts +0 -62
- package/src/cli-primitives/divider.ts +0 -17
- package/src/cli-primitives/header.ts +0 -18
- package/src/cli-primitives/index.ts +0 -13
- package/src/cli-primitives/server-fallback.ts +0 -54
- package/src/cli-primitives/spinner.ts +0 -133
- package/src/cli-primitives/step.ts +0 -22
- package/src/constants.ts +0 -313
- package/src/core.ts +0 -397
- package/src/example.ts +0 -210
- package/src/exports-module.ts +0 -311
- package/src/handlers/AnalyticsLogHandler.ts +0 -22
- package/src/handlers/ExportLogHandler.ts +0 -610
- package/src/handlers/FileLogHandler.ts +0 -169
- package/src/handlers/RemoteLogHandler.ts +0 -42
- package/src/handlers/index.ts +0 -8
- package/src/hooks/HookManager.ts +0 -177
- package/src/hooks/index.ts +0 -1
- package/src/index.ts +0 -395
- package/src/main.ts +0 -196
- package/src/serializers/SerializerRegistry.ts +0 -173
- package/src/serializers/index.ts +0 -1
- package/src/style.css +0 -96
- package/src/styling/LogStyleBuilder.ts +0 -355
- package/src/styling/SemanticStyles.ts +0 -380
- package/src/styling/SmartPresets.ts +0 -288
- package/src/styling/StyleBuilder.ts +0 -319
- package/src/styling/StyleCache.ts +0 -131
- package/src/styling/banners.ts +0 -168
- package/src/styling/index.ts +0 -27
- package/src/styling/themes.ts +0 -235
- package/src/styling-module.ts +0 -244
- package/src/terminal/color-converter.ts +0 -315
- package/src/terminal/formatter.ts +0 -236
- package/src/terminal/terminal-renderer.ts +0 -342
- package/src/transports/ConsoleTransport.ts +0 -28
- package/src/transports/FileTransport.ts +0 -53
- package/src/transports/HttpTransport.ts +0 -56
- package/src/transports/TransportManager.ts +0 -130
- package/src/transports/index.ts +0 -4
- package/src/types/core.ts +0 -417
- package/src/types/handlers.ts +0 -95
- package/src/types/hooks.ts +0 -45
- package/src/types/index.ts +0 -83
- package/src/types/serializers.ts +0 -30
- package/src/types/transports.ts +0 -52
- package/src/typescript.svg +0 -1
- package/src/utils/adapter.ts +0 -291
- package/src/utils/ansi-colors.ts +0 -333
- package/src/utils/environment-detector.ts +0 -170
- package/src/utils/environment.ts +0 -94
- package/src/utils/formatting.ts +0 -332
- package/src/utils/index.ts +0 -33
- package/src/utils/opentui-detection.ts +0 -138
- package/src/utils/output.ts +0 -227
- package/src/utils/stackTrace.ts +0 -144
- package/src/utils/timestamps.ts +0 -80
- package/src/vite-env.d.ts +0 -1
- package/src/writers/BufferWriter.ts +0 -157
- package/src/writers/index.ts +0 -6
- package/test-core-browser.html +0 -237
- package/test-core-node.js +0 -63
- package/tests/test-conflict-resolution.ts +0 -391
- package/tests/validate-workflows.sh +0 -131
- package/tests/yaml-autofix.sh +0 -146
- package/tsconfig.json +0 -50
- package/vite.config.ts +0 -256
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Export and clipboard commands for Advanced Logger CLI
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type { ICommand } from '../CommandProcessor.js';
|
|
6
|
-
import type { Logger } from '../../Logger.js';
|
|
7
|
-
import type { ExportFormat, ExportFilters, ExportOptions, LogLevel } from '../../types/index.js';
|
|
8
|
-
import { EXPORT_FORMATS } from '../../constants.js';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Parse command line arguments into filters and options
|
|
12
|
-
*/
|
|
13
|
-
function parseArguments(args: string): { filters: ExportFilters; options: ExportOptions; format?: ExportFormat } {
|
|
14
|
-
const filters: ExportFilters = {};
|
|
15
|
-
const options: ExportOptions = {};
|
|
16
|
-
let format: ExportFormat | undefined;
|
|
17
|
-
|
|
18
|
-
if (!args.trim()) return { filters, options };
|
|
19
|
-
|
|
20
|
-
// Split args by spaces, but keep quoted strings together
|
|
21
|
-
const argParts = args.match(/(?:[^\s"]+|"[^"]*")+/g) || [];
|
|
22
|
-
|
|
23
|
-
for (let i = 0; i < argParts.length; i++) {
|
|
24
|
-
const arg = argParts[i];
|
|
25
|
-
|
|
26
|
-
// Skip if arg is null/undefined
|
|
27
|
-
if (!arg) {
|
|
28
|
-
continue;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Format (first argument without --)
|
|
32
|
-
if (i === 0 && !arg.startsWith('--') && arg in EXPORT_FORMATS) {
|
|
33
|
-
format = arg as ExportFormat;
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Parse --flags
|
|
38
|
-
if (arg.startsWith('--')) {
|
|
39
|
-
const [flag, value] = arg.slice(2).split('=');
|
|
40
|
-
|
|
41
|
-
switch (flag) {
|
|
42
|
-
case 'level':
|
|
43
|
-
case 'levels':
|
|
44
|
-
if (value) {
|
|
45
|
-
filters.levels = value.split(',').map(l => l.trim()) as LogLevel[];
|
|
46
|
-
}
|
|
47
|
-
break;
|
|
48
|
-
case 'since':
|
|
49
|
-
if (value) filters.since = value;
|
|
50
|
-
break;
|
|
51
|
-
case 'until':
|
|
52
|
-
if (value) filters.until = value;
|
|
53
|
-
break;
|
|
54
|
-
case 'prefix':
|
|
55
|
-
case 'prefixes':
|
|
56
|
-
if (value) {
|
|
57
|
-
filters.prefixes = value.split(',').map(p => p.trim());
|
|
58
|
-
}
|
|
59
|
-
break;
|
|
60
|
-
case 'exclude-prefix':
|
|
61
|
-
case 'exclude-prefixes':
|
|
62
|
-
if (value) {
|
|
63
|
-
filters.excludePrefixes = value.split(',').map(p => p.trim());
|
|
64
|
-
}
|
|
65
|
-
break;
|
|
66
|
-
case 'last':
|
|
67
|
-
if (value) filters.last = parseInt(value, 10);
|
|
68
|
-
break;
|
|
69
|
-
case 'first':
|
|
70
|
-
if (value) filters.first = parseInt(value, 10);
|
|
71
|
-
break;
|
|
72
|
-
case 'search':
|
|
73
|
-
if (value) filters.search = value.replace(/['"]/g, '');
|
|
74
|
-
break;
|
|
75
|
-
case 'with-stack':
|
|
76
|
-
filters.withStackTrace = true;
|
|
77
|
-
break;
|
|
78
|
-
case 'errors-only':
|
|
79
|
-
filters.errorsOnly = true;
|
|
80
|
-
break;
|
|
81
|
-
case 'group-by':
|
|
82
|
-
if (value) {
|
|
83
|
-
filters.groupBy = value as ExportFilters['groupBy'];
|
|
84
|
-
options.groupBy = value as ExportOptions['groupBy'];
|
|
85
|
-
}
|
|
86
|
-
break;
|
|
87
|
-
case 'minimal':
|
|
88
|
-
options.minimal = true;
|
|
89
|
-
break;
|
|
90
|
-
case 'compact':
|
|
91
|
-
options.compact = true;
|
|
92
|
-
break;
|
|
93
|
-
case 'styled':
|
|
94
|
-
options.styled = true;
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return { filters, options, format };
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Export command - export logs in various formats
|
|
105
|
-
*/
|
|
106
|
-
export class ExportCommand implements ICommand {
|
|
107
|
-
name = 'export';
|
|
108
|
-
description = 'Export logs to various formats';
|
|
109
|
-
usage = '/export <format> [--filter=value] [--option]';
|
|
110
|
-
|
|
111
|
-
execute(args: string, logger: Logger): void {
|
|
112
|
-
const exportHandler = logger.getExportHandler();
|
|
113
|
-
if (!exportHandler) {
|
|
114
|
-
logger.error('Export handler not available. Make sure ExportLogHandler is registered.');
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const { filters, options, format } = parseArguments(args);
|
|
119
|
-
|
|
120
|
-
if (!format) {
|
|
121
|
-
logger.error('Format required. Available formats: ' + Object.keys(EXPORT_FORMATS).join(', '));
|
|
122
|
-
logger.info('Usage: /export <format> [--filter=value]');
|
|
123
|
-
logger.info('Example: /export json --level=error,warn --last=50');
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
try {
|
|
128
|
-
const result = exportHandler.export(format, filters, options);
|
|
129
|
-
|
|
130
|
-
// Log success with metadata
|
|
131
|
-
logger.success(`✅ Export completed: ${result.metadata.filteredLogs} logs exported in ${format} format`);
|
|
132
|
-
|
|
133
|
-
// Show preview for small exports
|
|
134
|
-
if (result.data.length < 1000) {
|
|
135
|
-
logger.group(`📄 Preview (${format.toUpperCase()})`);
|
|
136
|
-
console.log(result.data);
|
|
137
|
-
logger.groupEnd();
|
|
138
|
-
} else {
|
|
139
|
-
logger.info(`📄 Export size: ${(result.data.length / 1024).toFixed(2)}KB`);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// Show metadata
|
|
143
|
-
logger.table({
|
|
144
|
-
format: result.format,
|
|
145
|
-
totalLogs: result.metadata.totalLogs,
|
|
146
|
-
filtered: result.metadata.filteredLogs,
|
|
147
|
-
exported: result.metadata.exportedAt
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
} catch (error) {
|
|
151
|
-
logger.error('Export failed:', error);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Copy command - copy logs to clipboard
|
|
158
|
-
*/
|
|
159
|
-
export class CopyCommand implements ICommand {
|
|
160
|
-
name = 'copy';
|
|
161
|
-
description = 'Copy logs to clipboard';
|
|
162
|
-
usage = '/copy <format> [--filter=value] [--option]';
|
|
163
|
-
|
|
164
|
-
async execute(args: string, logger: Logger): Promise<void> {
|
|
165
|
-
const exportHandler = logger.getExportHandler();
|
|
166
|
-
if (!exportHandler) {
|
|
167
|
-
logger.error('Export handler not available. Make sure ExportLogHandler is registered.');
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const { filters, options, format } = parseArguments(args);
|
|
172
|
-
|
|
173
|
-
if (!format) {
|
|
174
|
-
logger.error('Format required. Available formats: ' + Object.keys(EXPORT_FORMATS).join(', '));
|
|
175
|
-
logger.info('Usage: /copy <format> [--filter=value]');
|
|
176
|
-
logger.info('Example: /copy plain --level=error --last=25');
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
try {
|
|
181
|
-
const success = await exportHandler.copyToClipboard(format, filters, options);
|
|
182
|
-
|
|
183
|
-
if (success) {
|
|
184
|
-
const result = exportHandler.export(format, filters, options);
|
|
185
|
-
logger.success(`📋 Copied ${result.metadata.filteredLogs} logs to clipboard (${format} format)`);
|
|
186
|
-
} else {
|
|
187
|
-
logger.error('Failed to copy to clipboard. Browser may not support clipboard API.');
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
} catch (error) {
|
|
191
|
-
logger.error('Copy failed:', error);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Buffer-size command - configure buffer size
|
|
198
|
-
*/
|
|
199
|
-
export class BufferSizeCommand implements ICommand {
|
|
200
|
-
name = 'buffer-size';
|
|
201
|
-
description = 'Set log buffer size';
|
|
202
|
-
usage = '/buffer-size <size>';
|
|
203
|
-
|
|
204
|
-
execute(args: string, logger: Logger): void {
|
|
205
|
-
const exportHandler = logger.getExportHandler();
|
|
206
|
-
if (!exportHandler) {
|
|
207
|
-
logger.error('Export handler not available.');
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
const size = parseInt(args.trim(), 10);
|
|
212
|
-
if (isNaN(size) || size <= 0) {
|
|
213
|
-
logger.error('Invalid buffer size. Must be a positive number.');
|
|
214
|
-
logger.info('Example: /buffer-size 2000');
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
exportHandler.setBufferSize(size);
|
|
219
|
-
logger.success(`Buffer size set to ${size}`);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Clear-buffer command - clear log buffer
|
|
225
|
-
*/
|
|
226
|
-
export class ClearBufferCommand implements ICommand {
|
|
227
|
-
name = 'clear-buffer';
|
|
228
|
-
description = 'Clear the log buffer';
|
|
229
|
-
usage = '/clear-buffer';
|
|
230
|
-
|
|
231
|
-
execute(_args: string, logger: Logger): void {
|
|
232
|
-
const exportHandler = logger.getExportHandler();
|
|
233
|
-
if (!exportHandler) {
|
|
234
|
-
logger.error('Export handler not available.');
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
const stats = exportHandler.getBufferStats();
|
|
239
|
-
exportHandler.clearBuffer();
|
|
240
|
-
|
|
241
|
-
logger.success(`✅ Buffer cleared. Removed ${stats.size} log entries.`);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Buffer-info command - show buffer information
|
|
247
|
-
*/
|
|
248
|
-
export class BufferInfoCommand implements ICommand {
|
|
249
|
-
name = 'buffer-info';
|
|
250
|
-
description = 'Show buffer statistics and information';
|
|
251
|
-
usage = '/buffer-info';
|
|
252
|
-
|
|
253
|
-
execute(_args: string, logger: Logger): void {
|
|
254
|
-
const exportHandler = logger.getExportHandler();
|
|
255
|
-
if (!exportHandler) {
|
|
256
|
-
logger.error('Export handler not available.');
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
const stats = exportHandler.getBufferStats();
|
|
261
|
-
|
|
262
|
-
logger.group('📊 Buffer Information');
|
|
263
|
-
logger.table({
|
|
264
|
-
size: `${stats.size}/${stats.maxSize}`,
|
|
265
|
-
usage: `${stats.usage.toFixed(1)}%`,
|
|
266
|
-
oldestLog: stats.oldestLog?.toLocaleString() || 'None',
|
|
267
|
-
newestLog: stats.newestLog?.toLocaleString() || 'None'
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
logger.group('📈 Log Level Counts');
|
|
271
|
-
logger.table(stats.levelCounts);
|
|
272
|
-
logger.groupEnd();
|
|
273
|
-
|
|
274
|
-
logger.groupEnd();
|
|
275
|
-
}
|
|
276
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview History management commands for CLI
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type { ICommand } from '../CommandProcessor.js';
|
|
6
|
-
import type { Logger } from '../../Logger.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Show command history
|
|
10
|
-
*/
|
|
11
|
-
export class HistoryCommand implements ICommand {
|
|
12
|
-
name = 'history';
|
|
13
|
-
description = 'Show command execution history';
|
|
14
|
-
usage = '/history [limit] - Show recent commands (default: 10)';
|
|
15
|
-
category = 'system';
|
|
16
|
-
aliases = ['hist', 'h'];
|
|
17
|
-
|
|
18
|
-
execute(args: string, logger: Logger): void {
|
|
19
|
-
const processor = (logger as any).cliProcessor;
|
|
20
|
-
if (!processor) {
|
|
21
|
-
logger.error('CLI processor not available');
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const limit = parseInt(args) || 10;
|
|
26
|
-
const history = processor.getHistory().slice(0, limit);
|
|
27
|
-
|
|
28
|
-
if (history.length === 0) {
|
|
29
|
-
logger.info('📝 No command history available');
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
logger.info(`📋 Last ${history.length} commands:`);
|
|
34
|
-
|
|
35
|
-
history.forEach((entry: any, index: number) => {
|
|
36
|
-
const status = entry.success ? '✅' : '❌';
|
|
37
|
-
const time = entry.timestamp.toLocaleTimeString();
|
|
38
|
-
logger.info(`${status} [${time}] ${entry.command}`);
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Clear command history
|
|
45
|
-
*/
|
|
46
|
-
export class ClearHistoryCommand implements ICommand {
|
|
47
|
-
name = 'clearhistory';
|
|
48
|
-
description = 'Clear command execution history';
|
|
49
|
-
usage = '/clearhistory - Remove all command history';
|
|
50
|
-
category = 'system';
|
|
51
|
-
aliases = ['clrhist'];
|
|
52
|
-
|
|
53
|
-
execute(args: string, logger: Logger): void {
|
|
54
|
-
const processor = (logger as any).cliProcessor;
|
|
55
|
-
if (!processor) {
|
|
56
|
-
logger.error('CLI processor not available');
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
processor.clearHistory();
|
|
61
|
-
logger.success('🗑️ Command history cleared');
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Interactive mode command
|
|
67
|
-
*/
|
|
68
|
-
export class InteractiveCommand implements ICommand {
|
|
69
|
-
name = 'interactive';
|
|
70
|
-
description = 'Enter interactive CLI mode';
|
|
71
|
-
usage = '/interactive - Start interactive command mode';
|
|
72
|
-
category = 'system';
|
|
73
|
-
aliases = ['i', 'repl'];
|
|
74
|
-
|
|
75
|
-
execute(args: string, logger: Logger): void {
|
|
76
|
-
const processor = (logger as any).cliProcessor;
|
|
77
|
-
if (!processor) {
|
|
78
|
-
logger.error('CLI processor not available');
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
processor.enterInteractiveMode(logger);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Plugin management command
|
|
88
|
-
*/
|
|
89
|
-
export class PluginsCommand implements ICommand {
|
|
90
|
-
name = 'plugins';
|
|
91
|
-
description = 'List loaded CLI plugins';
|
|
92
|
-
usage = '/plugins - Show all registered plugins';
|
|
93
|
-
category = 'system';
|
|
94
|
-
aliases = ['plug'];
|
|
95
|
-
|
|
96
|
-
execute(args: string, logger: Logger): void {
|
|
97
|
-
const processor = (logger as any).cliProcessor;
|
|
98
|
-
if (!processor) {
|
|
99
|
-
logger.error('CLI processor not available');
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const plugins = processor.getPlugins();
|
|
104
|
-
|
|
105
|
-
if (plugins.length === 0) {
|
|
106
|
-
logger.info('🔌 No plugins registered');
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
logger.info(`🔌 Loaded plugins (${plugins.length}):`);
|
|
111
|
-
|
|
112
|
-
plugins.forEach((plugin: any) => {
|
|
113
|
-
logger.info(` 📦 ${plugin.name} v${plugin.version} - ${plugin.description}`);
|
|
114
|
-
logger.info(` Commands: ${plugin.commands.map((c: any) => c.name).join(', ')}`);
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Status and demo commands for Advanced Logger CLI
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type { ICommand } from '../CommandProcessor.js';
|
|
6
|
-
import type { Logger } from '../../Logger.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Status command - show logger configuration and statistics
|
|
10
|
-
*/
|
|
11
|
-
export class StatusCommand implements ICommand {
|
|
12
|
-
name = 'status';
|
|
13
|
-
description = 'Show current logger status and configuration';
|
|
14
|
-
usage = '/status';
|
|
15
|
-
|
|
16
|
-
execute(_args: string, logger: Logger): void {
|
|
17
|
-
const config = logger.getConfig();
|
|
18
|
-
const statusData = {
|
|
19
|
-
theme: config.theme ? config.theme : 'default',
|
|
20
|
-
verbosity: config.verbosity,
|
|
21
|
-
colors: config.enableColors,
|
|
22
|
-
timestamps: config.enableTimestamps,
|
|
23
|
-
stackTrace: config.enableStackTrace,
|
|
24
|
-
globalPrefix: config.globalPrefix ? config.globalPrefix : 'none',
|
|
25
|
-
bannerType: config.bannerType ? config.bannerType : 'simple',
|
|
26
|
-
handlers: logger.getHandlers().length,
|
|
27
|
-
bufferSize: config.bufferSize ? config.bufferSize : 1000
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
logger.group('⚙️ Logger Configuration');
|
|
31
|
-
logger.table(statusData);
|
|
32
|
-
logger.groupEnd();
|
|
33
|
-
|
|
34
|
-
// Show buffer stats if ExportLogHandler is present
|
|
35
|
-
const exportHandler = logger.getExportHandler();
|
|
36
|
-
if (exportHandler) {
|
|
37
|
-
const bufferStats = exportHandler.getBufferStats();
|
|
38
|
-
logger.group('📊 Buffer Statistics');
|
|
39
|
-
logger.table({
|
|
40
|
-
size: `${bufferStats.size}/${bufferStats.maxSize}`,
|
|
41
|
-
usage: `${bufferStats.usage.toFixed(1)}%`,
|
|
42
|
-
oldestLog: bufferStats.oldestLog ? bufferStats.oldestLog.toISOString() : 'None',
|
|
43
|
-
newestLog: bufferStats.newestLog ? bufferStats.newestLog.toISOString() : 'None',
|
|
44
|
-
errorCount: bufferStats.levelCounts.error + bufferStats.levelCounts.critical,
|
|
45
|
-
warningCount: bufferStats.levelCounts.warn
|
|
46
|
-
});
|
|
47
|
-
logger.groupEnd();
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Reset command - reset logger to defaults
|
|
54
|
-
*/
|
|
55
|
-
export class ResetCommand implements ICommand {
|
|
56
|
-
name = 'reset';
|
|
57
|
-
description = 'Reset logger configuration to defaults';
|
|
58
|
-
usage = '/reset';
|
|
59
|
-
|
|
60
|
-
execute(_args: string, logger: Logger): void {
|
|
61
|
-
logger.resetConfig();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Demo command - show logger feature demonstration
|
|
67
|
-
*/
|
|
68
|
-
export class DemoCommand implements ICommand {
|
|
69
|
-
name = 'demo';
|
|
70
|
-
description = 'Show comprehensive feature demonstration';
|
|
71
|
-
usage = '/demo';
|
|
72
|
-
|
|
73
|
-
execute(_args: string, logger: Logger): void {
|
|
74
|
-
logger.group('🎪 Advanced Logger Demo');
|
|
75
|
-
|
|
76
|
-
// Basic logging demo
|
|
77
|
-
logger.debug('Debug message with detailed information');
|
|
78
|
-
logger.info('Informational message about system state');
|
|
79
|
-
logger.warn('Warning about deprecated feature');
|
|
80
|
-
logger.error('Error processing user request');
|
|
81
|
-
logger.success('Operation completed successfully');
|
|
82
|
-
logger.critical('Critical system failure detected');
|
|
83
|
-
|
|
84
|
-
// Advanced features demo
|
|
85
|
-
logger.group('📊 Advanced Features Demo');
|
|
86
|
-
|
|
87
|
-
// Table demo
|
|
88
|
-
logger.table([
|
|
89
|
-
{ feature: 'Styled Console', status: '✅ Active', performance: 'Excellent' },
|
|
90
|
-
{ feature: 'Theme System', status: '✅ Active', performance: 'Great' },
|
|
91
|
-
{ feature: 'CLI Interface', status: '✅ Active', performance: 'Good' },
|
|
92
|
-
{ feature: 'Export System', status: '✅ Active', performance: 'Excellent' }
|
|
93
|
-
]);
|
|
94
|
-
|
|
95
|
-
// Timer demo
|
|
96
|
-
logger.time('demo-operation');
|
|
97
|
-
setTimeout(() => {
|
|
98
|
-
logger.timeEnd('demo-operation');
|
|
99
|
-
}, 100);
|
|
100
|
-
|
|
101
|
-
// SVG demo
|
|
102
|
-
logger.logWithSVG('SVG Demo');
|
|
103
|
-
|
|
104
|
-
// Animated demo
|
|
105
|
-
logger.logAnimated('🌟 Animated Logger Demo 🌟', 2);
|
|
106
|
-
|
|
107
|
-
logger.groupEnd();
|
|
108
|
-
logger.groupEnd();
|
|
109
|
-
|
|
110
|
-
logger.info('Demo completed! Check the console for styled output.');
|
|
111
|
-
}
|
|
112
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Theme and banner commands for Advanced Logger CLI
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type { ICommand } from '../CommandProcessor.js';
|
|
6
|
-
import type { Logger } from '../../Logger.js';
|
|
7
|
-
import type { BannerType } from '../../types/index.js';
|
|
8
|
-
import { THEME_PRESETS, BANNER_VARIANTS } from '../../styling/index.js';
|
|
9
|
-
import { StyleBuilder } from '../../styling/index.js';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Themes command - show available themes
|
|
13
|
-
*/
|
|
14
|
-
export class ThemesCommand implements ICommand {
|
|
15
|
-
name = 'themes';
|
|
16
|
-
description = 'Show available theme presets';
|
|
17
|
-
usage = '/themes';
|
|
18
|
-
|
|
19
|
-
execute(_args: string, logger: Logger): void {
|
|
20
|
-
logger.group('🎨 Available Themes');
|
|
21
|
-
Object.keys(THEME_PRESETS).forEach(themeName => {
|
|
22
|
-
const preview = (THEME_PRESETS as any)[themeName];
|
|
23
|
-
const previewStyle = new StyleBuilder()
|
|
24
|
-
.bg(preview.info.background)
|
|
25
|
-
.color(preview.info.color)
|
|
26
|
-
.padding('4px 8px')
|
|
27
|
-
.rounded('4px')
|
|
28
|
-
.border(preview.info.border)
|
|
29
|
-
.build();
|
|
30
|
-
|
|
31
|
-
console.log(`%c${themeName}`, previewStyle, `- ${themeName} theme preview`);
|
|
32
|
-
});
|
|
33
|
-
logger.groupEnd();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Banners command - show available banner types
|
|
39
|
-
*/
|
|
40
|
-
export class BannersCommand implements ICommand {
|
|
41
|
-
name = 'banners';
|
|
42
|
-
description = 'Show available banner types';
|
|
43
|
-
usage = '/banners';
|
|
44
|
-
|
|
45
|
-
execute(_args: string, logger: Logger): void {
|
|
46
|
-
logger.group('🖼️ Available Banner Types');
|
|
47
|
-
Object.keys(BANNER_VARIANTS).forEach(bannerName => {
|
|
48
|
-
const banner = (BANNER_VARIANTS as any)[bannerName];
|
|
49
|
-
console.log(`%c${bannerName}`, 'font-weight: bold; color: #667eea;');
|
|
50
|
-
console.log(`%cPreview:`, 'color: #666; font-size: 12px;');
|
|
51
|
-
|
|
52
|
-
// Show a mini preview
|
|
53
|
-
if (bannerName === 'simple') {
|
|
54
|
-
console.log(`%c${banner.text}`, banner.style);
|
|
55
|
-
} else if (bannerName === 'ascii') {
|
|
56
|
-
console.log(`%c${banner.text.split('\n').slice(1, 4).join('\n')}...`, 'font-family: monospace; color: #667eea; font-size: 10px;');
|
|
57
|
-
} else if (bannerName === 'unicode') {
|
|
58
|
-
console.log(`%c${banner.text}`, banner.style);
|
|
59
|
-
} else {
|
|
60
|
-
console.log(`%c${bannerName} banner`, 'color: #666; font-style: italic;');
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
logger.groupEnd();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Banner command - change/show banner type
|
|
69
|
-
*/
|
|
70
|
-
export class BannerCommand implements ICommand {
|
|
71
|
-
name = 'banner';
|
|
72
|
-
description = 'Change or show current banner type';
|
|
73
|
-
usage = '/banner [type]';
|
|
74
|
-
|
|
75
|
-
execute(args: string, logger: Logger): void {
|
|
76
|
-
if (!args) {
|
|
77
|
-
logger.showBanner();
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (args in BANNER_VARIANTS) {
|
|
82
|
-
logger.setBannerType(args as BannerType);
|
|
83
|
-
logger.showBanner();
|
|
84
|
-
} else {
|
|
85
|
-
logger.error(`Invalid banner type: ${args}. Available: ${Object.keys(BANNER_VARIANTS).join(', ')}`);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|