Log-Export im Monitor-Panel
- 📥 JSON Button: Exportiert alle Events als strukturiertes JSON - 📄 TXT Button: Exportiert als lesbarer Text - Enthält Zeitstempel, Stats und Filter-Status - Download als Datei (monitor-log.json / .txt) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
84dc806266
commit
88f2d22d12
1 changed files with 57 additions and 0 deletions
|
|
@ -68,6 +68,42 @@
|
|||
{ value: 'error', label: '🔴 Fehler' },
|
||||
{ value: 'debug', label: '⚪ Debug' },
|
||||
];
|
||||
|
||||
// Export-Funktionen
|
||||
function exportAsJson() {
|
||||
const data = {
|
||||
exportedAt: new Date().toISOString(),
|
||||
filter: $monitorFilter,
|
||||
stats: $monitorStats,
|
||||
events: $filteredMonitorEvents.map(e => ({
|
||||
...e,
|
||||
timestamp: e.timestamp.toISOString()
|
||||
}))
|
||||
};
|
||||
downloadFile(JSON.stringify(data, null, 2), 'monitor-log.json', 'application/json');
|
||||
}
|
||||
|
||||
function exportAsText() {
|
||||
const lines = $filteredMonitorEvents.map(e => {
|
||||
const time = formatTime(e.timestamp);
|
||||
const type = typeLabels[e.type].padEnd(6);
|
||||
const duration = e.durationMs ? `[${e.durationMs}ms]` : '';
|
||||
return `${time} ${monitorEventColors[e.type]} ${type} ${e.summary} ${duration}`.trim();
|
||||
});
|
||||
|
||||
const header = `Claude Desktop Monitor Log\nExportiert: ${new Date().toLocaleString('de-DE')}\nEvents: ${lines.length}\n${'─'.repeat(60)}\n\n`;
|
||||
downloadFile(header + lines.join('\n'), 'monitor-log.txt', 'text/plain');
|
||||
}
|
||||
|
||||
function downloadFile(content: string, filename: string, mimeType: string) {
|
||||
const blob = new Blob([content], { type: mimeType });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
a.click();
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="monitor-panel">
|
||||
|
|
@ -99,6 +135,12 @@
|
|||
<span>↓</span>
|
||||
</label>
|
||||
|
||||
<button class="export-btn" on:click={exportAsJson} title="Als JSON exportieren">
|
||||
📥 JSON
|
||||
</button>
|
||||
<button class="export-btn" on:click={exportAsText} title="Als Text exportieren">
|
||||
📄 TXT
|
||||
</button>
|
||||
<button class="clear-btn" on:click={clearMonitorEvents} title="Events löschen">
|
||||
🗑️
|
||||
</button>
|
||||
|
|
@ -275,6 +317,21 @@
|
|||
color: white;
|
||||
}
|
||||
|
||||
.export-btn {
|
||||
padding: 4px 8px;
|
||||
background: var(--bg-tertiary);
|
||||
border: none;
|
||||
border-radius: var(--radius-sm);
|
||||
cursor: pointer;
|
||||
font-size: 0.65rem;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.export-btn:hover {
|
||||
background: var(--accent);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.clear-btn {
|
||||
padding: 4px 8px;
|
||||
background: var(--bg-tertiary);
|
||||
|
|
|
|||
Loading…
Reference in a new issue