Skip to content

Unify logging: replace mixed eprintln! with structured tracing #28

@codesoda

Description

@codesoda

Summary

Structured tracing (tracing::info!, tracing::warn!, tracing::error!) is used in most modules, but claude_code.rs, main.rs, and update.rs emit diagnostic output via raw eprintln!, bypassing the tracing subscriber. Some events are double-logged. The entire update.rs (672 lines) has zero tracing calls.

Severity: S2 (Medium) | Confidence: 0.95 | Blast radius: Low

Technical Details

Double-logging (same event, two sinks):

// src/main.rs:357-358
tracing::error!("failed to write report: {e}");
eprintln!("WARNING: failed to write report: {e}");  // same event!

Verbose output bypassing tracing:

// src/claude_code.rs:174, 184, 229, 237, 238
eprintln!("[verbose] ...");  // should be tracing::debug!

Entire module invisible to structured logs:

  • src/update.rs — 672 lines, zero tracing:: calls, all output via eprintln!
  • Lines 375, 391, 559 — error/progress output that never appears in the log file created by diagnostics::init_tracing

Impact:

  • Post-mortem debugging of update failures requires reproducing the issue (no log trail)
  • Verbose provider output is invisible to the tracing subscriber and any log aggregation
  • The double-logging in main.rs produces duplicate entries in different formats

Proposed Fix

  1. update.rs: Replace all eprintln! calls with appropriate tracing::info! / tracing::warn! / tracing::error! calls (~10 replacements)
  2. claude_code.rs: Replace verbose eprintln!("[verbose]...") with tracing::debug! (lines 174, 184, 229, 237, 238)
  3. main.rs: Remove duplicate eprintln! calls where tracing::error! is already used (line 358). Keep eprintln! only for pre-tracing-init errors (acceptable fallback)

Estimated effort: ~3 hours

Related

  • Part of refactor Bundle 5: Unified Observability

🔍 Found by vibe-code-audit — automated codebase audit skill for Claude Code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    auditFound via automated code auditenhancementNew feature or requestobservabilityLogging, tracing, diagnostics

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions