From 6429cae9328193f02174625031c9dd8dd4c7b707 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Mon, 27 Jul 2020 10:37:36 +0100 Subject: [PATCH] Use isinstance() for type checking --- EDMCLogging.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EDMCLogging.py b/EDMCLogging.py index 69e8389b..acae327d 100644 --- a/EDMCLogging.py +++ b/EDMCLogging.py @@ -104,7 +104,7 @@ class EDMCContextFilter(logging.Filter): # of the frames internal to logging. frame = sys._getframe(0) while frame: - if type(frame.f_locals.get('self')) == logging.Logger: + if isinstance(frame.f_locals.get('self'), logging.Logger): frame = frame.f_back # Want to start on the next frame below break frame = frame.f_back @@ -113,7 +113,7 @@ class EDMCContextFilter(logging.Filter): # that is *not* true, as it should be the call site of the logger # call while frame: - if type(frame.f_locals.get('self')) != logging.Logger: + if not isinstance(frame.f_locals.get('self'), logging.Logger): break # We've found the frame we want frame = frame.f_back