mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-14 00:26:21 +00:00
New logging appears to work
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
|
||||
@@ -187,3 +188,34 @@ class Document(models.Model):
|
||||
@property
|
||||
def download_url(self):
|
||||
return reverse("fetch", kwargs={"pk": self.pk})
|
||||
|
||||
|
||||
class Log(models.Model):
|
||||
|
||||
LEVELS = (
|
||||
(logging.DEBUG, "Debugging"),
|
||||
(logging.INFO, "Informational"),
|
||||
(logging.WARNING, "Warning"),
|
||||
(logging.ERROR, "Error"),
|
||||
(logging.CRITICAL, "Critical"),
|
||||
)
|
||||
|
||||
COMPONENT_CONSUMER = 1
|
||||
COMPONENT_MAIL = 2
|
||||
COMPONENTS = (
|
||||
(COMPONENT_CONSUMER, "Consumer"),
|
||||
(COMPONENT_MAIL, "Mail Fetcher")
|
||||
)
|
||||
|
||||
group = models.UUIDField(blank=True)
|
||||
message = models.TextField()
|
||||
level = models.PositiveIntegerField(choices=LEVELS, default=logging.INFO)
|
||||
component = models.PositiveIntegerField(choices=COMPONENTS)
|
||||
created = models.DateTimeField(auto_now_add=True)
|
||||
modified = models.DateTimeField(auto_now=True)
|
||||
|
||||
class Meta(object):
|
||||
ordering = ("-modified",)
|
||||
|
||||
def __str__(self):
|
||||
return self.message
|
||||
|
Reference in New Issue
Block a user