Skip to content
Commit 0e703ad4 authored by Douglas Raillard's avatar Douglas Raillard
Browse files

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.
parent bf5b84cc
Loading
Loading
Loading
Loading
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