healthchecks_healthchecks/hc/logs/models.py
2024-05-24 13:58:18 +03:00

25 lines
629 B
Python

from __future__ import annotations
import logging
from django.db import models
from django.utils.timezone import now
LEVELS = [
(logging.NOTSET, "notset"),
(logging.DEBUG, "debug"),
(logging.INFO, "info"),
(logging.WARNING, "warning"),
(logging.ERROR, "error"),
(logging.CRITICAL, "critical"),
]
class Record(models.Model):
created = models.DateTimeField(default=now)
host = models.CharField(max_length=50, blank=True)
name = models.CharField(max_length=100)
level = models.PositiveSmallIntegerField(choices=LEVELS)
message = models.TextField()
traceback = models.TextField()