Skip to content

Instantly share code, notes, and snippets.

@piroyoung
Created January 9, 2018 22:51
Show Gist options
  • Save piroyoung/acc6fda5fd34eae873d29f8bf45d638c to your computer and use it in GitHub Desktop.
Save piroyoung/acc6fda5fd34eae873d29f8bf45d638c to your computer and use it in GitHub Desktop.
observing spent time
import time
from typing import Callable, Any
def print_timestamp(func: Callable) -> Callable:
def wrap_up(**kwargs) -> Any:
t0 = time.time()
res = func(**kwargs)
t1 = time.time()
logger.debug({'elapsed_time': t1-t0})
return res
return wrap_up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment