Add support for third-party logger classes

This commit is contained in:
Aleksandr Alekseev 2020-12-21 01:04:08 +03:00
parent 3440ab3c96
commit 1851b127db

View file

@ -10,7 +10,7 @@ HANDLED_STR = ['Unhandled', 'Handled']
class LoggingMiddleware(BaseMiddleware):
def __init__(self, logger=__name__):
if not isinstance(logger, logging.Logger):
if isinstance(logger, str):
logger = logging.getLogger(logger)
self.logger = logger