feat: add log and stat command#263
Conversation
fatelei
commented
Feb 14, 2026
There was a problem hiding this comment.
Pull request overview
Adds new boxlite logs and boxlite stats subcommands to the BoxLite CLI for viewing per-box console logs and box metrics.
Changes:
- Wire
logsandstatsinto the CLI command enum and dispatch inmain.rs. - Implement
logs(tail + follow) andstats(formatted snapshot output) command modules. - Add
notifydependency for filesystem-based log following.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| boxlite-cli/src/main.rs | Routes new Logs and Stats commands to their executors. |
| boxlite-cli/src/cli.rs | Adds logs/stats subcommands to clap CLI definition. |
| boxlite-cli/src/commands/mod.rs | Exposes new logs and stats modules. |
| boxlite-cli/src/commands/logs.rs | Implements log reading, tailing, and follow mode using notify. |
| boxlite-cli/src/commands/stats.rs | Implements metrics snapshot formatting + output format support. |
| boxlite-cli/Cargo.toml | Adds notify dependency to support logs --follow. |
| Cargo.lock | Locks new transitive dependencies from notify. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// Stream stats in real-time | ||
| #[arg(short = 's', long = "stream")] | ||
| pub stream: bool, |
There was a problem hiding this comment.
The PR description shows the --help output for the stats command, but it doesn't include the --stream option that's defined here in the code. This discrepancy suggests either the PR description is outdated or this option was added after generating the help text shown in the description. Please update the PR description to reflect the actual available options.
| if tail_lines == 0 { | ||
| // Read all lines | ||
| let reader = BufReader::new(file); | ||
| let lines: Vec<String> = reader.lines().collect::<Result<_, _>>()?; | ||
| Ok(lines) |
There was a problem hiding this comment.
When tail_lines is 0 (the default), the entire log file is read into memory at once. For very large log files, this could cause excessive memory usage. Consider streaming the output line by line instead of collecting all lines into a Vec first, or adding a warning/limit for large files.
|
@fatelei Thanks for the contribution! Merged |
|
Hi, great work! Quick confirmation: |
The current behavior is intended for debugging the box environment itself (kernel + agent), while persisted application logging is a feature that would need to be added to the runtime. |