Skip to content

feat: add log and stat command#263

Merged
DorianZheng merged 3 commits intoboxlite-ai:mainfrom
fatelei:issue-35
Feb 14, 2026
Merged

feat: add log and stat command#263
DorianZheng merged 3 commits intoboxlite-ai:mainfrom
fatelei:issue-35

Conversation

@fatelei
Copy link
Copy Markdown
Contributor

@fatelei fatelei commented Feb 14, 2026

 $ boxlite logs --help
  Show logs from a box
  Usage: boxlite logs [OPTIONS] <BOX>
  Options:
    -n, --tail <TAIL>    Number of lines to show from the end [default: 0]
    -f, --follow         Follow log output
$ boxlite stats --help
  Display live metrics for a box
  Usage: boxlite stats [OPTIONS] <BOX>
  Options:
    --format <FORMAT>  Output format (table, json, yaml) [default: table]

Copilot AI review requested due to automatic review settings February 14, 2026 05:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 logs and stats into the CLI command enum and dispatch in main.rs.
  • Implement logs (tail + follow) and stats (formatted snapshot output) command modules.
  • Add notify dependency 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.

Copilot AI review requested due to automatic review settings February 14, 2026 06:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +21 to +23
/// Stream stats in real-time
#[arg(short = 's', long = "stream")]
pub stream: bool,
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +68 to +72
if tail_lines == 0 {
// Read all lines
let reader = BufReader::new(file);
let lines: Vec<String> = reader.lines().collect::<Result<_, _>>()?;
Ok(lines)
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@DorianZheng
Copy link
Copy Markdown
Member

@fatelei Thanks for the contribution! Merged

@DorianZheng DorianZheng merged commit aeec89a into boxlite-ai:main Feb 14, 2026
19 of 20 checks passed
@shayne-snap
Copy link
Copy Markdown
Contributor

Hi, great work!

Quick confirmation: boxlite logs currently reads console.log (as I know it's guest/runtime console output), not application stdout/stderr like docker logs/podman logs. Is this the intended behavior for now, or should boxlite logs eventually represent persisted app logs semantics?

@fatelei
Copy link
Copy Markdown
Contributor Author

fatelei commented Feb 14, 2026

Hi, great work!

Quick confirmation: boxlite logs currently reads console.log (as I know it's guest/runtime console output), not application stdout/stderr like docker logs/podman logs. Is this the intended behavior for now, or should boxlite logs eventually represent persisted app logs semantics?

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants