Skip to content

fix: log each file path in verbose mode#815

Draft
kimjune01 wants to merge 2 commits into
tconbeer:mainfrom
kimjune01:fix/384-verbose-logging
Draft

fix: log each file path in verbose mode#815
kimjune01 wants to merge 2 commits into
tconbeer:mainfrom
kimjune01:fix/384-verbose-logging

Conversation

@kimjune01
Copy link
Copy Markdown

Summary

  • Added a display_output(f"Reading {display_path}") call in _format_one when verbose mode is enabled, so users can see which file is being processed
  • Uses lazy import for display_output to avoid circular imports
  • Falls back to absolute path when the file is outside the current working directory

Fixes #384

Test plan

  • pytest tests/ -v passes (1230 tests, 2 deselected for pre-existing env issue)
  • New test_verbose_logging verifies that --verbose --check --no-progressbar --single-process prints "Reading" and at least one SQL file name to stderr

kimjune01 added 2 commits May 11, 2026 20:32
Addresses issue tconbeer#384 by adding log output before attempting to read
each file when the --verbose flag is used. This helps users identify
which file caused an error, especially when processing many files.

Previously, verbose mode only showed files after they were processed.
Now it prints "Reading <filepath>" before processing each file,
making it easier to diagnose encoding errors or other file-specific
issues (as reported in tconbeer#383).

The implementation:
- Adds a print statement in _format_one() before reading the file
- Uses relative paths when possible for cleaner output
- Only prints when mode.verbose is True
- Works in both single-process and multiprocess modes

Test added to verify verbose logging shows file paths being processed.
The test asserted "Reading" or "Processing" in stderr, but the code only
emits "Reading". The "Processing" branch was dead and weakened the test.
@kimjune01 kimjune01 marked this pull request as draft May 22, 2026 21:29
@kimjune01
Copy link
Copy Markdown
Author

Cannot validate on current setup, so drafting. Please close or take it over.

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.

Improve verbose logging

1 participant