Skip to content
Snippets Groups Projects
Unverified Commit ac8686e2 authored by Mashiro's avatar Mashiro Committed by GitHub
Browse files

[Fix] Make logger compatible with python3.6 (#437)

* Makr logger compatible with python3.6

* minor refine

* fix as comment
parent 7b3397c6
No related branches found
No related tags found
No related merge requests found
...@@ -235,12 +235,15 @@ class MMLogger(Logger, ManagerMixin): ...@@ -235,12 +235,15 @@ class MMLogger(Logger, ManagerMixin):
level must be an int or a str. level must be an int or a str.
""" """
# Compatible with python3.6. `logging.Logger` does not have
# `_cache` attribute in python3.6.
self.level = logging._checkLevel(level) self.level = logging._checkLevel(level)
_accquire_lock() if hasattr(self, '_cache'):
# The same logic as `logging.Manager._clear_cache`. _accquire_lock()
for logger in MMLogger._instance_dict.values(): # The same logic as `logging.Manager._clear_cache`.
logger._cache.clear() for logger in MMLogger._instance_dict.values():
_release_lock() logger._cache.clear()
_release_lock()
def print_log(msg, def print_log(msg,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment