MCPcopy
hub / github.com/OpenBMB/ChatDev / log_exception

Method log_exception

utils/structured_logger.py:110–128  ·  view source on GitHub ↗

Log an exception with its traceback.

(self, exception: Exception, message: str = None, 
                      correlation_id: str = None, **kwargs)

Source from the content-addressed store, hash-verified

108 self._log(log_type, LogLevel.CRITICAL, message, correlation_id, **kwargs)
109
110 def log_exception(self, exception: Exception, message: str = None,
111 correlation_id: str = None, **kwargs) -> None:
112 """Log an exception with its traceback."""
113 if message is None:
114 message = str(exception)
115
116 # Include exception info
117 exception_info = {
118 "exception_type": type(exception).__name__,
119 "exception_message": str(exception),
120 "traceback": traceback.format_exc()
121 }
122
123 if isinstance(exception, MACException):
124 exception_info["error_code"] = exception.error_code
125 exception_info["exception_details"] = exception.details
126
127 self._log(LogType.ERROR, LogLevel.ERROR, message, correlation_id,
128 exception=exception_info, **kwargs)
129
130 def log_request(self, method: str, url: str, correlation_id: str = None, **kwargs):
131 """Log incoming request."""

Callers 15

handle_mac_exceptionFunction · 0.80
handle_general_exceptionFunction · 0.80
execute_workflowFunction · 0.80
download_sessionFunction · 0.80
get_workflow_argsFunction · 0.80
get_workflow_descFunction · 0.80
delete_workflowFunction · 0.80
rename_workflow_fileFunction · 0.80
copy_workflow_fileFunction · 0.80
get_workflow_raw_contentFunction · 0.80
run_workflow_syncFunction · 0.80

Calls 1

_logMethod · 0.95

Tested by

no test coverage detected