Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework stdlib compat #470

Closed
wants to merge 5 commits into from
Closed

Conversation

segfault
Copy link

Summary

Reworking a few things to allow make_filtering_bound_logger to provide FilteringBoundLogger's that inherit from BoundLogger instead of BoundLoggerBase which results in stdlib logger compatibility. Additionally adding a wrapper property for filters which was missing from BoundLogger.

This should close #469 and result in the docs matching what's being provided by make_filtering_bound_logger, so I believe no documentation will need to be updated.

Pull Request Check List

  • Added tests for changed code.
    • The CI fails with less than 100% coverage.
  • New APIs are added to typing_examples.py.
  • Updated documentation for changed code.
    • New functions/classes have to be added to docs/api.rst by hand.
    • Changed/added classes/methods/functions have appropriate versionadded, versionchanged, or deprecated directives.
      Find the appropriate next version in our __init__.py file.
  • Documentation in .rst and .md files is written using semantic newlines.
  • Changes (and possible deprecations) are documented in the changelog.
  • Consider granting push permissions to the PR branch, so maintainers can fix minor issues themselves without pestering you.

As noted in hynek#469, `make_filtering_bound_logger` was returning
a `BoundLoggerBase` with minimal functionality. These changes
refactor the `BoundLogger` definition to avoid circular dependencies
and allow for it's use in `make_filtering_bound_logger`.
This helps increase compatibility when attempting to use structlog
in place of the stdlib logger in existing code.
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.

Improving make_filtering_bound_logger's compatibility with the stdlib logger
2 participants