Log an exception with its traceback.
(self, exception: Exception, message: str = None,
correlation_id: str = None, **kwargs)
| 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.""" |
no test coverage detected