Add verbose logging control with --verbose flag#20
Open
tzermias wants to merge 1 commit into
Open
Conversation
Implements Phase 1 of the interactive progress and verbosity plan: global --verbose/-v flag to control debug output visibility. Changes: - New pkg/logger package with thread-safe conditional logging - Added --verbose/-v persistent flag to root command - Replaced all log.Printf calls with logger.Printf throughout codebase - Debug logs now suppressed by default, enabled with --verbose - Error messages always display regardless of verbose mode Features: - SetVerbose(bool) to enable/disable verbose logging - Printf/Println only print when verbose is enabled - Error/Errorf always print (regardless of verbose setting) - Thread-safe with sync.RWMutex for concurrent access - Comprehensive test coverage (5 tests, all passing) Files modified: - cmd/root.go: Added --verbose flag and logger integration - pkg/jiecang/jiecang.go: Switched to logger.Printf (3 calls) - pkg/jiecang/memory.go: Switched to logger.Printf (1 call) - hack/test.go: Switched to logger package with verbose enabled New files: - pkg/logger/logger.go: Conditional logging implementation - pkg/logger/logger_test.go: Test suite with 5 tests Testing: - All unit tests pass (make test) - Integration test confirms --verbose/-v flags work correctly - Code formatted (make fmt) and vetted (make vet) - Binary build successful (make build) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Phase 1 of the interactive progress and verbosity control plan:
a global
--verbose/-vflag to control debug output visibility.pkg/loggerpackage with thread-safe conditional logging--verbose/-vpersistent flag to root commandlog.Printfcalls withlogger.Printfthroughout codebase--verboseTest Plan
make test) - 5 new tests inpkg/logger--verboseand-vflags work correctlymake fmt)make vet)make build)Usage
🤖 Generated with Claude Code