rust-logs
Monitor Rust backend logs and sidecar output in real-time.
Bridge Required
This command requires an active bridge connection with the updated dev_bridge.rs that supports the /logs endpoint.
Usage
Options
| Option | Description | Default |
|---|---|---|
--level <level> |
Minimum log level: trace, debug, info, warn, error |
— |
--target <regex> |
Filter by Rust module path (regex) | — |
--source <source> |
Filter by source: rust, sidecar, all, or sidecar:<name> |
all |
--filter <regex> |
Filter messages by regex pattern | — |
--interval <ms> |
Poll interval in milliseconds | 500 |
--duration <ms> |
Auto-stop after N milliseconds | — |
--json |
Output one JSON object per line | — |
--port <number> |
Bridge port (auto-discover if omitted) | — |
--token <string> |
Bridge token (auto-discover if omitted) | — |
Examples
Monitor all Rust logs
Monitoring Rust logs... (Ctrl+C to stop)
[12:34:56.789] [INFO] myapp::db: Connected to database
[12:34:57.123] [WARN] myapp::api: Rate limit approaching
[12:34:57.456] [ERROR] myapp::auth: Token expired for user 42
Only show warnings and errors
Level filtering is severity-based (like RUST_LOG): --level warn shows warn and error, filtering out trace, debug, and info.
Filter by module path
The --target option accepts a regex, so myapp::db matches myapp::db, myapp::db::pool, etc.
Monitor sidecar output only
Or filter to a specific sidecar:
Auto-stop after 30 seconds
JSON output
{"timestamp":1710000000000,"level":"info","target":"myapp::db","message":"Connected to database","source":"rust"}
{"timestamp":1710000001000,"level":"warn","target":"stderr","message":"deprecated flag used","source":"sidecar:ffmpeg"}
How It Works
Unlike console-monitor which injects JavaScript to capture console output, rust-logs reads from a server-side log buffer:
- The bridge's
BridgeLogLayercapturestracingevents into a ring buffer (max 1000 entries) - Sidecar processes spawned via
spawn_sidecar_monitored()pipe stdout/stderr into the same buffer - The CLI polls
POST /logsat the specified interval, which drains the buffer and returns all entries - Entries are filtered client-side by level, target, source, and text pattern
Output Format
Rust logs:
Sidecar logs:
Notes
- Level filtering is severity-based:
--level warnshows warn AND error (unlikeconsole-monitorwhich does exact match) - The log buffer holds up to 1000 entries between polls — if your app produces more, increase poll frequency with
--interval - No cleanup is needed on exit (unlike
console-monitor, there are no JavaScript patches to undo) - If the bridge doesn't support
/logs(old version), you'll get a clear error asking you to updatedev_bridge.rs