Accept lowercase logging level names and accept tuples when setting exception handlers (#1233)

* Accept lowercase logging level names

* Accept both lists and tuples when setting Worker exception_handlers
main
Pierre Mdawar 5 years ago committed by GitHub
parent e1cbc3736c
commit 0dd9ff0ec9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,7 +20,9 @@ def setup_loghandlers(level=None, date_format=DEFAULT_LOGGING_DATE_FORMAT,
logger.addHandler(handler)
if level is not None:
logger.setLevel(level)
# The level may be a numeric value (e.g. when using the logging module constants)
# Or a string representation of the logging level
logger.setLevel(level if isinstance(level, int) else level.upper())
def _has_effective_handler(logger):

@ -210,7 +210,7 @@ class Worker(object):
self.disable_default_exception_handler = disable_default_exception_handler
if isinstance(exception_handlers, list):
if isinstance(exception_handlers, (list, tuple)):
for handler in exception_handlers:
self.push_exc_handler(handler)
elif exception_handlers is not None:

Loading…
Cancel
Save