Skip to content

Conversation

@zacharyblasczyk
Copy link
Member

@zacharyblasczyk zacharyblasczyk commented Jan 29, 2026

Summary by CodeRabbit

  • New Features
    • Added log-level configuration support via command-line flag and environment variable (CTRLPLANE_LOG_LEVEL).
    • Supports debug, info, warn, and error logging levels with "info" as the default.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 29, 2026

📝 Walkthrough

Walkthrough

This pull request introduces Viper-based configuration management for the log-level flag, binding a persistent flag to the CTRLPLANE_LOG_LEVEL environment variable and retrieving the value via viper.GetString() in the root command's initialization hook. The refactoring replaces the dynamic defaultOrEnv helper function with a fixed "info" default.

Changes

Cohort / File(s) Summary
Log-level Configuration via Viper
cmd/ctrlc/ctrlc.go, cmd/ctrlc/root/root.go
Integrates Viper for centralized log-level configuration, binding the persistent flag to CTRLPLANE_LOG_LEVEL environment variable. Replaces dynamic default resolution via defaultOrEnv helper with fixed "info" default and viper.GetString() retrieval. Removes os import and defaultOrEnv helper function from root.go.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly Related PRs

Poem

🐰 A flag once wild, now Viper-bound,
CTRLPLANE_LOG_LEVEL found!
From env to config, a cleaner way,
Log levels dancing through the day.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore(log-levels): Refactor log level env flag' accurately describes the main change: refactoring log level environment variable handling by introducing Viper configuration and replacing the defaultOrEnv helper.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zacharyblasczyk zacharyblasczyk merged commit 8909954 into main Jan 29, 2026
3 checks passed
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.

3 participants