fix: config log level - #209
Conversation
The bootstrap logger only ever read OLLA_LOG_LEVEL, so logging.level in config.yaml was parsed but silently ignored. Rebuild the logger after config load using the file's level (with OLLA_LOGGING_LEVEL still able to override it, as config.Load already applies), falling back to the default with a warning on an invalid value rather than crashing. Also moved flag.Parse out of init() into main() - calling it at package init time breaks go test for the main package, which is what surfaced once a _test.go file was added here.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
WalkthroughThe change adds case-insensitive log-level validation, defers flag parsing until ChangesRuntime logging
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant main
participant Configuration
participant resolveRuntimeLogLevel
participant IsValidLevel
participant RuntimeLogger
main->>Configuration: load configuration
main->>resolveRuntimeLogLevel: resolve configured level
resolveRuntimeLogLevel->>IsValidLevel: validate level
IsValidLevel-->>resolveRuntimeLogLevel: return validity
resolveRuntimeLogLevel-->>main: return effective level
main->>RuntimeLogger: rebuild when level differs
RuntimeLogger-->>main: return logger and cleanup handle
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
wires logging.level from config.yaml to the runtime logger (previously parsed but ignored); precedence is OLLA_LOGGING_LEVEL env > config file > default, invalid values warn and fall back rather than crash; also moves flag.Parse() out of init(), fixing go test on the main package.
Summary by CodeRabbit
New Features
Bug Fixes