lisa.utils: Speedup Loggable.get_logger()
FIX Logging directly or indirectly inside a destructor (__del__) is problematic as they are invoked when the world is breaking down around them, which can trigger some harmless exceptions. For this reason, get_logger() was returning a dummy logger if __del__ was found in the stack. inspect.stack() is unfortunately really slow (150ms to get a stack frame of depth 25), which is enough to really slowdown the import of some modules and runtime code as well. Fix that by returning a wrapped logger object that will only inpsect the stack if an exception is raised.
Loading
Please register or sign in to comment