Skip to content

Instantly share code, notes, and snippets.

@esenthil2018
Created January 16, 2022 04:31
Show Gist options
  • Select an option

  • Save esenthil2018/4fbfaa430ee90ddf79207052bda363cf to your computer and use it in GitHub Desktop.

Select an option

Save esenthil2018/4fbfaa430ee90ddf79207052bda363cf 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