Decorator to log timing information for functions/routes
(func)
| 33 | |
| 34 | |
| 35 | def print_timing(func): |
| 36 | """Decorator to log timing information for functions/routes""" |
| 37 | |
| 38 | @functools.wraps(func) |
| 39 | def wrapper(*args, **kwargs): |
| 40 | start_time = time.time() |
| 41 | logger.info(f"Starting {func.__name__}") |
| 42 | try: |
| 43 | return func(*args, **kwargs) |
| 44 | finally: |
| 45 | elapsed = time.time() - start_time |
| 46 | logger.info(f"Completed {func.__name__} in {elapsed:.2f}s") |
| 47 | |
| 48 | return wrapper |
| 49 | |
| 50 | |
| 51 | class TimeoutError(Exception): |
nothing calls this directly
no outgoing calls
no test coverage detected