From 88f2d22d12960de83389fadb4a3cebab446982c3 Mon Sep 17 00:00:00 2001 From: Eddy Date: Tue, 14 Apr 2026 14:08:23 +0200 Subject: [PATCH] Log-Export im Monitor-Panel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 📥 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 --- src/lib/components/MonitorPanel.svelte | 57 ++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/src/lib/components/MonitorPanel.svelte b/src/lib/components/MonitorPanel.svelte index 8d20cc9..a4da24a 100644 --- a/src/lib/components/MonitorPanel.svelte +++ b/src/lib/components/MonitorPanel.svelte @@ -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); + }
@@ -99,6 +135,12 @@ + + @@ -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);