Repository navigation
feat(cli): leveled logger + --verbose/--quiet flags - #8
Merged
ironystock merged 1 commit intoApr 28, 2026
Merged
Conversation
Adds charmbracelet/log as the package-level structured logger and wires
two new persistent flags on rootCmd:
-v, --verbose count (1 = info, 2+ = debug; default = warn)
--quiet (overrides -v, clamps to error only)
Output discipline: logs always go to stderr; stdout stays reserved for
command output users may pipe (lists, JSON, success lines). With
--json and no -v, logs are silenced entirely so the JSON stream stays
pristine for jq/scripting; --json with -v flips the formatter to JSON
on stderr.
Two instrumentation sites in this PR:
- client.do() now emits debug logs on http request entry, exit, and
failure (method, url, status / err). Every command that goes through
the shared do() path picks this up automatically.
- config.loadConfig()'s prior "warning: could not parse config file"
stderr write is now a structured logger.Warn — visible at default
level since warnings still emit.
Other fmt.Print* sites untouched: they're user-facing data, not logs.
Tests: TestConfigureLogger_LevelMatrix exercises the precedence matrix
across {default, -v, -vv, -vvv, --quiet, --quiet+-vv, --json,
--json+-v}. Existing pair tests untouched.
Note for users: cobra previously bound -v to --version. -v now means
--verbose; --version still works in long form.
Co-Authored-By: Claude Opus 4.7 <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
charmbracelet/logas the package-level structured logger.rootCmd:-v/--verbose(count) and--quiet.client.do()debug logs around the HTTP round-trip, andconfig.loadConfig's parse-warning swapped tologger.Warn.Stacking
This PR is stacked on #7 (refactor split). Base =
refactor/cmd-rememberize-split. When #7 merges tomain, GitHub will automatically retarget this PR's base tomain.Level matrix
-v-vv(or more)--quiet--quiet -vv--jsonalone--json -vFiles
Verification
go build ./...clean.go test ./...green (new test passes; existing pair tests untouched).go vet ./...clean../bin/rememberize --helpshows the two new flags.Heads-up: tiny breaking change
Cobra previously bound
-vto--version. After this PR,-vmeans--verbose. The long form--versionstill works. Anyone scriptingrememberize -vto get the version will now see verbose-mode output (with no command). Universal CLI convention favors-vfor verbose; the long-form--versionis the supported scripting path.Test plan
rememberize -vv list(against a configured server) showsDEBUG http requestandDEBUG http responselines on stderr; barerememberize listshows none.rememberize --json listproduces clean JSON on stdout (no log noise).What's next (not this PR)
PR 3 wraps the cobra root with
charmbracelet/fangfor styled--help/--version. PR 4 swapstext/tabwriterfor lipgloss tables. PR 5 swapsbufioprompts for huh in the pair flow.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmithwith what you need.