Skip to content

Instantly share code, notes, and snippets.

@esenthil2018
Created January 17, 2022 07:58
Show Gist options
  • Save esenthil2018/b5eb920bddff84fd36c6fd87f4c682d0 to your computer and use it in GitHub Desktop.
Save esenthil2018/b5eb920bddff84fd36c6fd87f4c682d0 to your computer and use it in GitHub Desktop.
def logged(fn):
from functools import wraps
from datetime import datetime, timezone
@wraps(fn)
def wrapper(*args, **kwargs):
run = datetime.now(timezone.utc)
res = fn(*args, **kwargs)
print('{0}: called {1}'.format(fn.__name__, run))
return res
return wrapper
@logged
def product(a,b,c):
print('The product of a*b*c:', a*b*c)
product(3,5,6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment