Check if loggers exists in connection_observers
@@ -49,11 +49,13 @@ class ConnectionObserver(object):
return '{}(id:{})'.format(self.__class__.__name__, instance_id(self))
def __del__(self):
+ if hasattr(self, "device_logger"):
device_handlers = self.device_logger.handlers[:]
for handler in device_handlers:
handler.close()
self.device_logger.removeHandler(handler)
+ if hasattr(self, "logger"):
handlers = self.logger.handlers[:]
for handler in handlers:
handler.close()
