Skip to content

Add machine-readable (JSON) log output to all CLI tools#57

Draft
sjoerdsimons with Copilot wants to merge 4 commits into
mainfrom
copilot/add-json-formatted-log-output
Draft

Add machine-readable (JSON) log output to all CLI tools#57
sjoerdsimons with Copilot wants to merge 4 commits into
mainfrom
copilot/add-json-formatted-log-output

Conversation

Copilot AI commented Jul 7, 2026

Copy link
Copy Markdown

All CLI binaries only supported human-readable log output, with no way to consume logs programmatically.

Changes

  • {aptlyctl,apt2aptly,obs2aptly,aptly-latest-snapshots}/Cargo.toml: enable the json feature for tracing-subscriber
  • Each binary's main.rs:
    • Add LogFormat enum (pretty | json) with clap::ValueEnum
    • Add --log-format to Opts
    • Extract subscriber initialization into a local fn init_tracing(LogFormat) helper
    • Fix initialization order to Opts::parse()init_tracing()color_eyre::install() so ErrorLayer is registered before color-eyre's hook runs
  • aptlyctl/src/repo.rs: fix pre-existing clippy::useless_conversion warning

Usage

aptlyctl --log-format json snapshot list
obs2aptly --log-format json my-repo ./obs-packages

JSON output uses tracing-subscriber's built-in JSON formatter; pretty (the default) preserves existing behavior.

Copilot AI requested review from Copilot and removed request for Copilot July 7, 2026 15:09
Copilot AI linked an issue Jul 7, 2026 that may be closed by this pull request
Copilot AI requested review from Copilot and removed request for Copilot July 7, 2026 15:17
Copilot AI requested review from Copilot and removed request for Copilot July 7, 2026 15:21
Copilot AI requested review from Copilot and removed request for Copilot July 7, 2026 15:23
Copilot AI changed the title [WIP] Add machine-readable log output in JSON format Add machine-readable (JSON) log output to all CLI tools Jul 7, 2026
Copilot AI requested a review from sjoerdsimons July 7, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Machine-readable log output

2 participants