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
logging style parameter does not work correctly #64441
Comments
In Python 3.3, 3.4beta2, and bleeding edge (88411:e7d922d8ee03), the following occurs >>> import logging
>>> logging.basicConfig(style="{")
>>> logging.error("hello")
%(levelname)s:%(name)s:%(message)s Of course, I would expect ERROR:root:hello to be output instead. |
I created a patch that fixes this behavior for both { and $ style formats. Previously, default format strings were not being set correctly for those styles. This patch ensures that the correct default_format string is used. There is a minor "weirdness" issue that, due to there previously being 2 different default format strings for % style formatting, some tests rely on one, and some tests rely on the other. My patch remains backwards compatible with both default styles of format strings. This patch also includes test cases for behavior with the style keyword, which was not being tested before. |
Thanks for this. The patch looks good, and I expect to implement it shortly. |
On further reflection, I will implement this slightly differently. The tests I will commit as is, except for stripping newlines before the comparison (to avoid worrying about differences in line separators across different platforms). However, the correct fix IMO is to add the default format strings to the _STYLES dict values: the effect should be the same. |
New changeset e7fcf0d8008f by Vinay Sajip in branch '3.3': New changeset c1605d24fb35 by Vinay Sajip in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: