Created
March 18, 2019 18:48
-
-
Save dustinvtran/02254a0dde7e1c55c4f52f68258e20dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TRACE_STACK = [lambda f, *args, **kwargs: f(*args, **kwargs)] | |
@contextmanager | |
def trace(tracer): | |
TRACE_STACK.append(tracer) | |
yield | |
TRACE_STACK.pop() | |
def traceable(func): | |
def func_wrapped(*args, **kwargs): | |
return TRACE_STACK[-1](func, *args, **kwargs) | |
return func_wrapped |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment