Created
January 17, 2022 07:58
-
-
Save esenthil2018/b5eb920bddff84fd36c6fd87f4c682d0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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