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:
12 files changed
+423
-11
No files matched your search
@@ -143,6 +143,21 @@ class HttpApiClient implements ApiClient {
|
||||
return data.list ?? [];
|
||||
},
|
||||
stream: (options) => this.openLogStream(options),
|
||||
exportTrace: async () => {
|
||||
const res = await this.request('/api/logs/export/trace');
|
||||
if (!res.ok) {
|
||||
const payload = await readJson<ErrorPayload>(res);
|
||||
throw new ApiError(
|
||||
res.status,
|
||||
extractErrorMessage(payload, res.statusText || '导出失败'),
|
||||
payload.code,
|
||||
);
|
||||
}
|
||||
const disposition = res.headers.get('Content-Disposition') ?? '';
|
||||
const filename = disposition.match(/filename="([^"]+)"/)?.[1]
|
||||
?? 'snowluma-trace.log';
|
||||
return { text: await res.text(), filename };
|
||||
},
|
||||
getLevel: () => this.getJson<{ level: LogLevel; levels: LogLevel[] }>(`/api/logs/level`),
|
||||
setLevel: (level) =>
|
||||
this.postJson<{ level: LogLevel; levels: LogLevel[] }>(`/api/logs/level`, { level }),
|
||||
|
||||
Reference in new issue
Block a user