1
0
Fork 0
mirror of synced 2024-06-02 10:44:40 +12:00
Rare/rare/utils/metrics.py

11 lines
252 B
Python
Raw Normal View History

import time
from contextlib import contextmanager
from logging import Logger
@contextmanager
def timelogger(logger: Logger, title: str):
start = time.perf_counter()
yield
logger.debug("%s: %s seconds", title, time.perf_counter() - start)