Source code for management.models.logging
"""Logging Configuration Model."""
from __future__ import annotations
from django.db import models
from django.utils.translation import gettext_lazy as _
[docs]
class LoggingConfig(models.Model):
"""Logging Configuration model."""
[docs]
class LogLevelChoices(models.TextChoices):
"""Types of log levels."""
[docs]
DEBUG = '0', _('Debug')
[docs]
WARNING = '2', _('Warning')
[docs]
ERROR = '3', _('Error')
[docs]
CRITICAL = '4', _('Critical')
[docs]
log_level = models.CharField(max_length=8, choices=LogLevelChoices, default=LogLevelChoices.INFO)
[docs]
last_updated = models.DateTimeField(auto_now=True)
def __str__(self) -> str:
"""Output as string."""
return f'{self.log_level}'