Skip to content

refactor: replace all println/eprintln with tracing#14

Open
markovejnovic wants to merge 10 commits into
mainfrom
refactor/better-telemetry
Open

refactor: replace all println/eprintln with tracing#14
markovejnovic wants to merge 10 commits into
mainfrom
refactor/better-telemetry

Conversation

@markovejnovic
Copy link
Copy Markdown
Contributor

Summary

  • Add custom CliLayer tracing subscriber that routes user::stdout/user::stderr targets to the correct output streams with no tracing metadata decoration
  • Replace all 93 println!/eprintln!/print!/eprint! occurrences across hm and hm-plugin-cloud crates with tracing::info!(target: "user::*", ...) calls
  • Subscriber always initializes with CliLayer (user-facing output) + optional fmt layer (diagnostic tracing, --verbose only)
  • Consolidate tracing/tracing-subscriber as workspace dependencies
  • Upgrade clippy::print_stdout and clippy::print_stderr lints from warn to deny

Architecture

Two-layer subscriber:

  1. CliLayer (always active) — filters events with target user::stdout → stdout, user::stderr → stderr, no decoration
  2. FmtLayer (--verbose only) — standard tracing-subscriber fmt for diagnostics

Edge case: clap help/version/error text uses raw std::io::Write with scoped #[allow] (2 occurrences in hm-plugin-cloud/src/cli.rs).

Test Plan

  • All 76 workspace tests pass
  • cargo clippy --workspace clean — zero print lint violations
  • CliLayer unit tests: stdout routing, stderr routing, target filtering, format args, empty messages
  • Pre-existing cmd_run_local_autoselect failures confirmed unrelated (missing Python harmont module)
  • Manual: hm --version prints to stdout
  • Manual: hm --verbose --version shows diagnostic output on stderr
  • Manual: hm run error output appears on stderr with styling

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.

1 participant