Skip to content

feat: add --log-level to control CLI logging - #52

Open
Spidy092 wants to merge 1 commit into
karust:mainfrom
Spidy092:codex/log-level-option
Open

Spidy092 wants to merge 1 commit into
karust:mainfrom
Spidy092:codex/log-level-option

Conversation

@Spidy092

@Spidy092 Spidy092 commented Sep 3, 2026

Copy link
Copy Markdown

Summary

Add --log-level so commands such as openserp search bing "golang" --log-level error can suppress warnings, including the warning emitted when no default config file exists.

The setting also supports app.log_level and OPENSERP_APP_LOG_LEVEL, with CLI > environment > config precedence. A non-empty value overrides the logging threshold selected by quiet/verbose/debug; an empty value retains existing defaults. Existing logger output destinations and browser settings are preserved.

Closes #44.

Why

The missing-config warning was logged before normal logger initialization. The merged log level is now applied before startup warnings and reapplied after logger setup. Invalid levels return a configuration error before search starts.

Testing

  • make fmt
  • make test (full suite with race detector)
  • make lint (go vet and golangci-lint v1.64.8)
  • go build
  • npx --yes @redocly/cli lint docs/openapi.yaml (passes with 9 warnings in the unchanged specification)
  • Regression tests for config/environment/CLI precedence, startup warnings, invalid values, explicit missing config paths, and legacy logging flag interactions.
  • Built CLI checks for help, warning suppression, environment overrides, and errors remaining visible on stderr. Used the unsupported Bing raw-mode path to avoid browser/network requests.

Live engine integration tests were not run; the change is confined to CLI logging configuration.

Checklist

  • Linked the related issue.
  • Updated README and example configuration.
  • Kept tests deterministic and independent of browsers/search engines.
  • Kept the change focused on logging configuration.

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.

Add a --log-level option to control log verbosity

1 participant