FEATURE: Client-side console log capturing and streaming endpoint #46

Closed
opened 2026-05-24 11:21:21 +01:00 by Gandalf · 1 comment
Owner

FEATURE: Client-side console log capturing and streaming API endpoint with dual-authentication

Problem / Requirement:
To aid in frontend troubleshooting, developers need a way to capture and gather client-side console logs (console.log, console.warn, console.error) and make them accessible over a real-time log stream endpoint. This helps debug frontend issues (such as SSE failures, CSP violations, and state synchronization issues) in environments without direct access to browser devtools.

Success Criteria:

  1. Client-Side Interceptor: Intercept standard browser console methods at SPA startup and place captured logs into an in-memory queue.
  2. Batched Log Transmission (Selected Option A): Periodic HTTP POST batch queries to POST /api/debug/client-logs (every 2 seconds or when the queue hits 20 items) to minimize browser thread and network overhead.
  3. Server storage and SSE log streaming:
    • Save incoming logs into a separate rolling 1000-line buffer clientLogBuffer.
    • Expose GET /api/debug/client-logs to stream client-side logs in real-time via SSE.
  4. Security & Configuration:
    • Enableable only when the environment variable ENABLE_LOG_STREAM=true is set.
    • Enforce exact same dual-auth rules (Emby session cookie, Basic Auth fallback, and X-Webhook-Secret header bypass) on both client logs endpoints.
  5. API Documentation: Documented in server/openapi.yaml.
FEATURE: Client-side console log capturing and streaming API endpoint with dual-authentication Problem / Requirement: To aid in frontend troubleshooting, developers need a way to capture and gather client-side console logs (console.log, console.warn, console.error) and make them accessible over a real-time log stream endpoint. This helps debug frontend issues (such as SSE failures, CSP violations, and state synchronization issues) in environments without direct access to browser devtools. Success Criteria: 1. Client-Side Interceptor: Intercept standard browser console methods at SPA startup and place captured logs into an in-memory queue. 2. Batched Log Transmission (Selected Option A): Periodic HTTP POST batch queries to POST /api/debug/client-logs (every 2 seconds or when the queue hits 20 items) to minimize browser thread and network overhead. 3. Server storage and SSE log streaming: • Save incoming logs into a separate rolling 1000-line buffer clientLogBuffer. • Expose GET /api/debug/client-logs to stream client-side logs in real-time via SSE. 4. Security & Configuration: • Enableable only when the environment variable ENABLE_LOG_STREAM=true is set. • Enforce exact same dual-auth rules (Emby session cookie, Basic Auth fallback, and X-Webhook-Secret header bypass) on both client logs endpoints. 5. API Documentation: Documented in server/openapi.yaml.
Gandalf added the Kind/Feature
Priority
Medium
3
labels 2026-05-24 11:21:21 +01:00
Author
Owner

Resolved in commit 3c6791658c.

Resolved in commit 3c6791658c8fb05f15b84cbdba1815eef40823d1.
Gandalf added the Area/Frontend label 2026-05-28 11:58:05 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Gandalf/sofarr#46