diff options
| author | Pinapelz <yukais@pinapelz.com> | 2024-04-13 01:08:10 -0700 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2024-04-13 01:08:10 -0700 |
| commit | 163e07adb573da8497c9ccf0ae97a6c261e7b14a (patch) | |
| tree | 72c1763fbb76b8fc24b318ffa7c4028273ebf01b /decorators.py | |
initial commit. Migration from GitLab
Diffstat (limited to 'decorators.py')
| -rw-r--r-- | decorators.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/decorators.py b/decorators.py new file mode 100644 index 0000000..bc0b420 --- /dev/null +++ b/decorators.py @@ -0,0 +1,16 @@ +import time + + +def log(message: str): + def decorator(func): + def wrapper(*args, **kwargs): + print("TASK: " + message) + start = time.time() + result = func(*args, **kwargs) + end = time.time() + print(f"COMPLETE: {message} {round(end - start, 3)} seconds") + return result + + return wrapper + + return decorator |
