Tag incidents with categories for summaries
This commit is contained in:
@@ -44,9 +44,11 @@ def _get_logger(cfg: dict[str, Any]) -> logging.Logger:
|
||||
return logger
|
||||
|
||||
|
||||
def log_incident(cfg: dict[str, Any], text: str) -> None:
|
||||
def log_incident(cfg: dict[str, Any], text: str, category: str | None = None) -> None:
|
||||
if not cfg.get("incidents", {}).get("enabled", True):
|
||||
return
|
||||
if category and "category=" not in text:
|
||||
text = f"category={category} {text}"
|
||||
logger = _get_logger(cfg)
|
||||
logger.info(text)
|
||||
|
||||
|
||||
@@ -70,6 +70,6 @@ async def notify(
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
log_incident(cfg, text)
|
||||
log_incident(cfg, text, category=category)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user