Skip to content
Snippets Groups Projects
Commit 83f92a1b authored by pswain's avatar pswain
Browse files

agora.logging to agora.logging_timer

parent 99f81b8c
No related branches found
No related tags found
No related merge requests found
import logging
from time import perf_counter
def timer(func):
"""Log duration of a function into the aliby log file."""
def wrap_func(*args, **kwargs):
t1 = perf_counter()
result = func(*args, **kwargs)
logging.getLogger("aliby").debug(
f"{func.__qualname__} took {(perf_counter()-t1):.4f}s"
)
return result
return wrap_func
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