Argus
Argus copied to clipboard
Rework plugin exceptions to always log
From comment on argus_ticket_rt:
Note: One idea I saw regarding logging of exceptions: log from the exception itself.
import logging class MyError(Exception): "Helpful docs" def __init__(self, msg): logging.exception(msg) super().__init__(msg)The above is as minimal as it gets, the whole thing was a bit more elaborate: Stackoverflow: comment to "Logging and raising an exception". Needs testing to see if the traceback is saved.
As later polish, this would cut down on code in plugins even further.
Originally posted by @hmpf in https://github.com/Uninett/argus_ticket_rt/pull/24#pullrequestreview-1412338040