Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The handler config override uses format_ instead of the expected alias key format, which may prevent the env-var format override from applying reliably.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR extends beans_logging.auto so runtime logger behavior can be customized via environment variables, specifically adding support for overriding the default handler log format without code changes.
Changes:
- Read
BEANS_LOGGING_AUTO_FORMATand apply it to the default std handler configuration. - Refactor handler option overrides (colorization + format) into a single
_handler_configdict, only injectingconfigwhen overrides exist.
File summaries
| File | Description |
|---|---|
| src/beans_logging/auto.py | Adds env-var-driven handler format override and refactors handler config assembly. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+22
to
+23
| if _format: | ||
| _handler_config["format_"] = _format |
| _is_colorized = validator.is_truthy( | ||
| os.environ.get("BEANS_LOGGING_AUTO_COLORIZED", "True") | ||
| ) | ||
| _format = os.environ.get("BEANS_LOGGING_AUTO_FORMAT") |
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.
This pull request updates the logging configuration in
src/beans_logging/auto.pyto allow more flexible control via environment variables. The main change is that you can now set the log format and colorization using environment variables, making it easier to customize logging behavior without modifying code.Configuration improvements:
BEANS_LOGGING_AUTO_FORMATenvironment variable and passing it to the logger handler configuration._handler_configdictionary and only including it in the logger configuration if needed, resulting in cleaner and more extensible code.