Created
January 9, 2018 22:51
-
-
Save piroyoung/acc6fda5fd34eae873d29f8bf45d638c to your computer and use it in GitHub Desktop.
observing spent time
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
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