2022.01.30 버그 픽스
This commit is contained in:
25
lib/utils.py
Normal file
25
lib/utils.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import os
|
||||
import time
|
||||
from functools import wraps
|
||||
|
||||
try:
|
||||
from loguru import logger
|
||||
except:
|
||||
os.system(f"pip install loguru")
|
||||
from loguru import logger
|
||||
|
||||
|
||||
def yommi_timeit(func):
|
||||
@wraps(func)
|
||||
def timeit_wrapper(*args, **kwargs):
|
||||
start_time = time.perf_counter()
|
||||
result = func(*args, **kwargs)
|
||||
end_time = time.perf_counter()
|
||||
total_time = end_time - start_time
|
||||
# print(f"Function {func.__name__}{args} {kwargs} Took {total_time:.4f} secs")
|
||||
logger.debug(
|
||||
f"Function {func.__name__}{args} {kwargs} Took {total_time:.4f} secs"
|
||||
)
|
||||
return result
|
||||
|
||||
return timeit_wrapper
|
||||
Reference in New Issue
Block a user