diff options
Diffstat (limited to 'pydis_site/apps/api/models.py')
-rw-r--r-- | pydis_site/apps/api/models.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/pydis_site/apps/api/models.py b/pydis_site/apps/api/models.py index 86c99f86..a541e4ab 100644 --- a/pydis_site/apps/api/models.py +++ b/pydis_site/apps/api/models.py @@ -450,3 +450,45 @@ class Nomination(ModelReprMixin, models.Model): auto_now_add=True, help_text="The creation date of this nomination." ) + +class LogEntry(ModelReprMixin, models.Model): + """A log entry generated by one of the PyDis applications.""" + + application = models.CharField( + max_length=20, + help_text="The application that generated this log entry.", + choices=( + ('bot', 'Bot'), + ('seasonalbot', 'Seasonalbot'), + ('site', 'Website') + ) + ) + logger_name = models.CharField( + max_length=100, + help_text="The name of the logger that generated this log entry." + ) + timestamp = models.DateTimeField( + default=timezone.now, + help_text="The date and time when this entry was created." + ) + level = models.CharField( + max_length=8, # 'critical' + choices=( + ('debug', 'Debug'), + ('info', 'Info'), + ('warning', 'Warning'), + ('error', 'Error'), + ('critical', 'Critical') + ), + help_text=( + "The logger level at which this entry was emitted. The levels " + "correspond to the Python `logging` levels." + ) + ) + module = models.CharField( + max_length=100, + help_text="The fully qualified path of the module generating this log line." + ) + line = models.PositiveSmallIntegerField( + help_text="The line at which the log line was emitted." + ) |