Created
December 6, 2022 23:25
-
-
Save aktech/769e626ec5e38003061848d459dda06a to your computer and use it in GitHub Desktop.
timer
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 | |
import logging | |
def timer(func): | |
def inner(*args, **kwargs): | |
start = time.time() | |
rv = func(*args, **kwargs) | |
logger.info(f"Time taken to execute {func}: {time.time() - start}") | |
return rv | |
return inner |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment