feat(webui): add trace warning and full export

Require explicit acknowledgement whenever operators enable TRACE and keep its active state visible until they restore normal logging.\n\nAdd an authenticated browser download for the complete retained logging snapshot, including runtime context and clear privacy guidance, while preserving the existing filtered-view export and memory-only TRACE boundary.\n\nCover the transition, snapshot, formatting, download, and client contracts with focused regression tests.
This commit is contained in:
DrSmoothl committed 2026-07-31 12:40:51 +08:00
1 parent a67614fa09
commit c3a1970e1c
12 files changed
+423 -11

No files matched your search

+11 -7
View File
@@ -287,15 +287,19 @@ export function closeLogger(): Promise<void> {
return getFileTransport().close();
}
export function getRecentLogs(limit = 300): LogEntry[] {
const n = Math.max(1, Math.trunc(limit));
// Merge the normal + trace rings by id (ids are monotonic, so id order is
// chronological). The trace ring is empty unless trace level is/was active,
// so the common case is just the normal ring with no sort.
const merged = traceRing.size > 0
function mergeLogRings(): LogEntry[] {
return traceRing.size > 0
? [...logRing.toArray(), ...traceRing.toArray()].sort((a, b) => a.id - b.id)
: logRing.toArray();
return merged.slice(-n);
}
export function getLogSnapshot(): LogEntry[] {
return mergeLogRings();
}
export function getRecentLogs(limit = 300): LogEntry[] {
const n = Math.max(1, Math.trunc(limit));
return mergeLogRings().slice(-n);
}
export function subscribeLogs(callback: (entry: LogEntry) => void): () => void {