Skip to content

Add verbose mode, logging levels, log file output - #29

Open
grave0x wants to merge 1 commit into
mainfrom
logging
Open

Add verbose mode, logging levels, log file output#29
grave0x wants to merge 1 commit into
mainfrom
logging

Conversation

@grave0x

@grave0x grave0x commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Summary

Adds proper logging infrastructure with configurable verbosity, log file output, and structured log levels.

CLI flags

dwell -v doctor              # Debug level (also affects trait filter)
dwell -vv doctor             # Trace level
dwell --log-level debug doctor  # Explicit level override
dwell --log-file ~/dwell.log apply  # Write logs to file
dwell --quiet apply          # Only errors shown

Implementation

Output struct enhancements

  • Added level field (1-5 mapping: error→trace)
  • debug() method — dim blue dot, only at -v/--log-level=debug
  • trace() method — dim magenta hash, only at -vv/--log-level=trace
  • All methods check self.level before printing
  • Respects --quiet (only error level shows)

tracing_subscriber upgrade

  • Respects --log-level override
  • Supports --log-file <path> for file output
  • Falls back to stderr if file cannot be opened
  • No timestamp clutter in stderr mode

17 files updated

All Output::new() callers across all command modules.

Closes #26

Summary by Sourcery

Introduce configurable logging levels and optional log file output across the CLI, and route all command output through the new log-level-aware Output abstraction.

New Features:

  • Add CLI flags for explicit log level selection and log file output.
  • Add debug and trace output methods with structured, level-tagged messages in both text and JSON modes.

Enhancements:

  • Refine Output struct to use a unified numeric log level that honors verbosity and quiet settings instead of ad-hoc checks.
  • Update all command modules to construct Output with the resolved log level from CLI options.
  • Configure tracing subscriber to respect the chosen log level and optionally write logs to a file, falling back to stderr on failure.

- Added --log-file <path> CLI flag for file output
- Added --log-level <level> CLI flag (error/warn/info/debug/trace)
- -v sets debug, -vv sets trace (affects both tracing and Output)
- Output now has log level awareness: debug(), trace() methods
- Output respects level for filtering (quiet=error only, default=info)
- All 17 Output::new() callers updated for log_level parameter
- tracing_subscriber upgraded: file output, no targets, configurable level

Closes #26
Copilot AI review requested due to automatic review settings July 26, 2026 22:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@sourcery-ai

sourcery-ai Bot commented Jul 26, 2026

Copy link
Copy Markdown

🧙 Sourcery is reviewing your pull request!


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

grave0x added a commit that referenced this pull request Jul 26, 2026
* dwell: fix import_cmd.rs compile error from Output::new signature change

PR #29 added a 4th parameter (log_level) to Output::new but import_cmd.rs
was written before that change and only passes 3 arguments.

* dwell: cargo fmt

* dwell: fix clippy warnings in import_cmd.rs

---------

Co-authored-by: GitHub Actions Bot <github-actions@github.com>
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.

Feature Request: Verbose mode, Logging levels, Log file output

2 participants