MCPcopy
hub / github.com/stitionai/devika / wrapper

Function wrapper

src/logger.py:53–76  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

51
52 @wraps(func)
53 def wrapper(*args, **kwargs):
54 # Log entry point
55 if log_enabled:
56 logger.info(f"{request.path} {request.method}")
57
58 # Call the actual route function
59 response = func(*args, **kwargs)
60
61 from werkzeug.wrappers import Response
62
63 # Log exit point, including response summary if possible
64 try:
65 if log_enabled:
66 if isinstance(response, Response) and response.direct_passthrough:
67 logger.debug(f"{request.path} {request.method} - Response: File response")
68 else:
69 response_summary = response.get_data(as_text=True)
70 if 'settings' in request.path:
71 response_summary = "*** Settings are not logged ***"
72 logger.debug(f"{request.path} {request.method} - Response: {response_summary}")
73 except Exception as e:
74 logger.exception(f"{request.path} {request.method} - {e})")
75
76 return response
77 return wrapper
78 return decorator

Callers

nothing calls this directly

Calls 3

infoMethod · 0.80
debugMethod · 0.80
exceptionMethod · 0.80

Tested by

no test coverage detected