Skip to content

feat: improve logger configuration handling with dynamic format support - #89

Merged
bybatkhuu merged 1 commit into
mainfrom
dev
Aug 27, 2026
Merged

feat: improve logger configuration handling with dynamic format support#89
bybatkhuu merged 1 commit into
mainfrom
dev

Conversation

@bybatkhuu

Copy link
Copy Markdown
Owner

This pull request updates the logging configuration in src/beans_logging/auto.py to 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:

  • Added support for customizing the log format by reading the BEANS_LOGGING_AUTO_FORMAT environment variable and passing it to the logger handler configuration.
  • Refactored the way colorization and format options are applied by building a _handler_config dictionary and only including it in the logger configuration if needed, resulting in cleaner and more extensible code.

@bybatkhuu bybatkhuu self-assigned this Aug 27, 2026
Copilot AI lite review requested due to automatic review settings August 27, 2026 08:38
@bybatkhuu bybatkhuu added the feature [✨ Features] MINOR version label Aug 27, 2026
@bybatkhuu
bybatkhuu merged commit d6a784b into main Aug 27, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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_FORMAT and apply it to the default std handler configuration.
  • Refactor handler option overrides (colorization + format) into a single _handler_config dict, only injecting config when 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 thread src/beans_logging/auto.py
Comment on lines +22 to +23
if _format:
_handler_config["format_"] = _format
Comment thread src/beans_logging/auto.py
_is_colorized = validator.is_truthy(
os.environ.get("BEANS_LOGGING_AUTO_COLORIZED", "True")
)
_format = os.environ.get("BEANS_LOGGING_AUTO_FORMAT")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature [✨ Features] MINOR version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants