-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Improve resiliency of logging initialization phase #3705
Conversation
if PY2 and isinstance(lvl, text_type): | ||
try: | ||
lvl = lvl.encode('utf-8') | ||
except UnicodeError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're going to catch that, we may as well pass errors="ignore"
to the encode
call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, even better at this point would be using ascii
# default value for invalid input | ||
assert log._get_py_loglevel(None) == logging.INFO | ||
# default value for invalid unicode input | ||
assert log._get_py_loglevel(u'dèbùg') == logging.INFO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK this is valid utf-8 input, so it's encoded properly. I guess we need so weirder string to test it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the intention was to test a proper encoding but into a key that's invalid
Codecov Report
@@ Coverage Diff @@
## master #3705 +/- ##
==========================================
- Coverage 86.42% 83.96% -2.46%
==========================================
Files 730 62 -668
Lines 37041 4702 -32339
Branches 4360 574 -3786
==========================================
- Hits 32012 3948 -28064
+ Misses 3855 633 -3222
+ Partials 1174 121 -1053 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
What does this PR do?
Review checklist (to be filled by reviewers)
changelog/
andintegration/
labels attached