Spaces:
Runtime error
Runtime error
Download infrastructure/monitoring/alert.py from new-human/customs-data: direct link, hf CLI and curl.
- Browser
- Download file 561 Bytes
-
https://huggingface.co/spaces/new-human/customs-data/resolve/main/infrastructure/monitoring/alert.py
- Command line
-
hf download hf://spaces/new-human/customs-data/infrastructure/monitoring/alert.py
-
curl -L -o alert.py https://huggingface.co/spaces/new-human/customs-data/resolve/main/infrastructure/monitoring/alert.py
561 Bytes
| from packages.core.logger import app_logger | |
| def send_alert(title: str, message: str, level: str = "warning"): | |
| """ | |
| 通用告警模块: | |
| 未来可在此处接入钉钉/飞书/企业微信机器人的 Webhook。 | |
| 当前 MVP 阶段直接输出到高优先级日志。 | |
| """ | |
| alert_msg = f"🚨 [ALERT - {level.upper()}] {title}: {message}" | |
| if level == "critical" or level == "error": | |
| app_logger.error(alert_msg) | |
| else: | |
| app_logger.warning(alert_msg) | |
| # TODO: 实现 HTTP POST 调用飞书/钉钉 Webhook | |