Logs an error message, and optionally the stack trace of the most recent exception. Args: *args: Variable-length argument list to pass to the logger. trace (bool, optional): Whether to log the stack trace of the most recently caught exception. Defaults to True.
(self, *args, trace=True, **kwargs)
| 1693 | self.trace() |
| 1694 | |
| 1695 | def error(self, *args, trace=True, **kwargs): |
| 1696 | """Logs an error message, and optionally the stack trace of the most recent exception. |
| 1697 | |
| 1698 | Args: |
| 1699 | *args: Variable-length argument list to pass to the logger. |
| 1700 | trace (bool, optional): Whether to log the stack trace of the most recently caught exception. Defaults to True. |
| 1701 | **kwargs: Arbitrary keyword arguments to pass to the logger. |
| 1702 | |
| 1703 | Examples: |
| 1704 | >>> self.error("This is an error message") |
| 1705 | >>> self.error("This is an error message with a trace", trace=False) |
| 1706 | """ |
| 1707 | self.log.error(*args, extra={"scan_id": self.scan.id}, **kwargs) |
| 1708 | if trace: |
| 1709 | self.trace() |
| 1710 | |
| 1711 | def trace(self, msg=None): |
| 1712 | """Logs the stack trace of the most recently caught exception. |