Total Complexity | 1 |
Total Lines | 25 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import time |
||
|
|||
2 | from functools import wraps |
||
3 | |||
4 | from pocketutils.tools.unit_tools import UnitTools |
||
5 | |||
6 | from mandos.model.utils.setup import logger |
||
7 | |||
8 | |||
9 | def entry(): |
||
10 | @wraps(entry) |
||
11 | def dec(func): |
||
12 | def my_fn(*args, **kwargs): |
||
13 | t0 = time.monotonic() |
||
14 | results = func(*args, **kwargs) |
||
15 | delta = UnitTools.delta_time_to_str(time.monotonic() - t0) |
||
16 | logger.debug(f"Command took {delta}") |
||
17 | return results |
||
18 | |||
19 | return wraps(func)(my_fn) |
||
20 | |||
21 | return dec |
||
22 | |||
23 | |||
24 | __all__ = ["entry"] |
||
25 |