Skip to content

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_92

Supported Log Levels ​

LevelSeverityWhen to Use
traceLowestMicrosecond NAL unit parsing, low-level packet allocations
debugLowRTSP negotiation details, SDP exchange, keyframe detection
infoNormalServer startup, camera connect/disconnect, hourly file rotation
warnMediumSlow consumer buffer drops, RTSP socket retry, high disk watermark
errorHighStorage write failure, database corruption, invalid JWT signature
fatalHighestUnrecoverable 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: false

Environment variable override:

bash
export RUSEON_LOG_LEVEL=debug
export RUSEON_LOG_FORMAT=console

Released under the MIT License.