Skip to content

Instantly share code, notes, and snippets.

@aktech
Created December 6, 2022 23:25
Show Gist options
  • Save aktech/769e626ec5e38003061848d459dda06a to your computer and use it in GitHub Desktop.
Save aktech/769e626ec5e38003061848d459dda06a to your computer and use it in GitHub Desktop.
timer
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