New logging appears to work

This commit is contained in:
Daniel Quinn
2016-02-27 20:18:50 +00:00
parent e149baec4e
commit 2fe9b0cbc1
16 changed files with 346 additions and 188 deletions

View File

@@ -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