Tag incidents with categories for summaries

This commit is contained in:
2026-02-09 02:03:04 +03:00
parent 75113b6182
commit c91c961134
6 changed files with 11 additions and 9 deletions

View File

@@ -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)

View File

@@ -70,6 +70,6 @@ async def notify(
except Exception:
pass
try:
log_incident(cfg, text)
log_incident(cfg, text, category=category)
except Exception:
pass