Structured Logging & Log Management
RUSEON Core uses rs/zerolog as its native logging engine. Zerolog provides zero-allocation JSON logging designed specifically for high-throughput media servers where logging overhead must not introduce latency spikes into the streaming pipeline.
Log Output Formats
RUSEON Core supports two output formats configured via config.yaml or environment variables:
1. Production JSON Format (Default)
Emits structured NDJSON (Newline Delimited JSON) to stdout, ideal for ingestion by Loki, Elasticsearch, Datadog, and Fluentbit:
json
{"level":"info","time":"2026-08-14T14:26:32Z","camera_id":"cam_front","fps":25.0,"bitrate_kbps":4096,"message":"Stream ingestion synchronized"}
{"level":"warn","time":"2026-08-14T14:26:35Z","camera_id":"cam_front","subscriber_id":"webrtc_sub_92","message":"Slow consumer detected, skipping P-frame"}2. Console Pretty Format
Formatted, colored console output intended for interactive local development and debugging:
text
2:26PM INF Stream ingestion synchronized camera_id=cam_front fps=25.0 bitrate_kbps=4096
2:26PM WRN Slow consumer detected, skipping P-frame camera_id=cam_front subscriber_id=webrtc_sub_92Supported Log Levels
| Level | Severity | When to Use |
|---|---|---|
trace | Lowest | Microsecond NAL unit parsing, low-level packet allocations |
debug | Low | RTSP negotiation details, SDP exchange, keyframe detection |
info | Normal | Server startup, camera connect/disconnect, hourly file rotation |
warn | Medium | Slow consumer buffer drops, RTSP socket retry, high disk watermark |
error | High | Storage write failure, database corruption, invalid JWT signature |
fatal | Highest | Unrecoverable error forcing server shutdown |
Configuration Example
yaml
logging:
# Output format: "json" (production) or "console" (development)
format: "json"
# Log level filter: trace, debug, info, warn, error
level: "info"
# Include file and line number in log events
caller: falseEnvironment variable override:
bash
export RUSEON_LOG_LEVEL=debug
export RUSEON_LOG_FORMAT=console