Skip to content

bpo-41906: Accept built filters in dictConfig #30756

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

Merged
merged 1 commit into from
Jan 24, 2022

Conversation

mariocj89
Copy link
Contributor

@mariocj89 mariocj89 commented Jan 21, 2022

When configuring the logging stack, accept already built filters (or
just callables) in the filters array of loggers and handlers.
This facilitates passing quick callables as filters.

https://bugs.python.org/issue41906

Automerge-Triggered-By: GH:vsajip

Copy link
Member

@vsajip vsajip left a comment

Choose a reason for hiding this comment

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

Mostly stylistic points. Thanks!

@@ -126,6 +126,10 @@ in :mod:`logging` itself) and defining handlers which are declared either in
.. versionadded:: 3.10
The *encoding* parameter is added.

.. versionadded:: 3.11
Copy link
Member

Choose a reason for hiding this comment

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

This is in the wrong place (fileConfig rather than dictConfig) and in any case should perhaps be in the documentation on the details of the dictionary schema, in the filters bullet point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed 🤦 .
I've added it to the section of user custom objects, have a look and let me know if you think it fits there.
Should we also add it to both the handlers and loggers section?

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@mariocj89
Copy link
Contributor Author

mariocj89 commented Jan 24, 2022

Thanks for the review!

I have made the requested changes; please review again

See https://github.com/python/cpython/compare/54cf7ed267b2e47107995509b0e370733da54306..d3c975a91f42c509bea10476367efc9f72416936, let me know how you want the docs to appear and I will send another push changing that.

@bedevere-bot
Copy link

Thanks for making the requested changes!

@vsajip: please review the changes made to this pull request.

@bedevere-bot bedevere-bot requested a review from vsajip January 24, 2022 09:30
@@ -524,6 +524,10 @@ valid keyword parameter name, and so will not clash with the names of
the keyword arguments used in the call. The ``'()'`` also serves as a
mnemonic that the corresponding value is a callable.

.. versionadded:: 3.11
Copy link
Member

Choose a reason for hiding this comment

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

I've added it to the section of user custom objects, have a look and let me know if you think it fits there.
Should we also add it to both the handlers and loggers section?

Yes, it does belong here, but on reflection I think it should be a versionchanged rather than versionadded and this should also be in the bullets of handlers and loggers in the "Dictionary Schema Details" section where it currently says that filters are "A list of ids of the filters for this handler".

@@ -524,6 +524,10 @@ valid keyword parameter name, and so will not clash with the names of
the keyword arguments used in the call. The ``'()'`` also serves as a
mnemonic that the corresponding value is a callable.

.. versionadded:: 3.11
The ``filters`` member of ``handlers`` and ``loggers`` can take
filter instances in addition of ids.
Copy link
Member

Choose a reason for hiding this comment

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

change "in addition of ids" to "in addition to ids."

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

When configuring the logging stack, accept already built filters (or
just callables) in the filters array of loggers and handlers.
This facilitates passing quick callables as filters.
@mariocj89
Copy link
Contributor Author

I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@vsajip: please review the changes made to this pull request.

@mariocj89 mariocj89 deleted the pu/build-filters branch January 24, 2022 12:57
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.

5 participants