Mercurial > public > sg101
changeset 37:91fd31dc78fb
Removed the database logging stuff. Will replace with Python logging.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 11 Jun 2009 01:00:31 +0000 |
parents | 296b610ee507 |
children | c14cfd6be87a |
files | gpp/core/functions.py gpp/core/logging.py gpp/core/models.py |
diffstat | 3 files changed, 4 insertions(+), 67 deletions(-) [+] |
line wrap: on
line diff
--- a/gpp/core/functions.py Thu Jun 11 00:54:44 2009 +0000 +++ b/gpp/core/functions.py Thu Jun 11 01:00:31 2009 +0000 @@ -4,8 +4,6 @@ from django.contrib.sites.models import Site from django.conf import settings -from core import logging - def send_mail(subject, message, from_email, recipient_list, fail_silently = False, auth_user = None, auth_password = None): @@ -18,8 +16,8 @@ django.core.mail.send_mail(subject, message, from_email, recipient_list, fail_silently, auth_user, auth_password) - logging.info('EMAIL:\nFrom: %s\nTo: %s\nSubject: %s\nMessage:\n%s' % - (from_email, str(recipient_list), subject, message)) + #logging.info('EMAIL:\nFrom: %s\nTo: %s\nSubject: %s\nMessage:\n%s' % + # (from_email, str(recipient_list), subject, message)) def email_admins(subject, message): @@ -50,4 +48,3 @@ return full_name return user.username -# vim: ts=4 sw=4
--- a/gpp/core/logging.py Thu Jun 11 00:54:44 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -'''This module adds a simple logging facility to the portal. -Applications can log information to a database table for debugging. -The logger is similar to the python logging module. -The verbosity of the logging is controlled via settings.GPP_LOG_LEVEL. -''' - -from settings import GPP_LOG_LEVEL -from core.models import DebugLog - -DEBUG = 10 -INFO = 20 -WARNING = 30 -ERROR = 40 -CRITICAL = 50 - -def log(level, msg): - if GPP_LOG_LEVEL <= level: - log_item = DebugLog() - log_item.level = level - log_item.msg = msg - log_item.save() - -def debug(msg): - log(DEBUG, msg) - -def info(msg): - log(INFO, msg) - -def warning(msg): - log(WARNING, msg) - -def error(msg): - log(WARNING, msg) - -def critical(msg): - log(WARNING, msg)
--- a/gpp/core/models.py Thu Jun 11 00:54:44 2009 +0000 +++ b/gpp/core/models.py Thu Jun 11 01:00:31 2009 +0000 @@ -1,29 +1,5 @@ """ -This file contains the core Models used in gpp. +This file contains the core Models used in gpp +(None at this time). """ -from django.db import models - - -class DebugLog(models.Model): - '''Model to represent debug logs used during development; arbitary text can be stored''' - - LOG_LEVELS = ( - (0, 'Not Set'), - (10, 'Debug'), - (20, 'Info'), - (30, 'Warning'), - (40, 'Error'), - (50, 'Critical'), - ) - - timestamp = models.DateTimeField(auto_now_add = True) - level = models.IntegerField(choices = LOG_LEVELS) - msg = models.TextField() - - def __unicode__(self): - return '%s - %s' % (self.timestamp.strftime('%m/%d/%Y %H:%M:%S'), - self.msg[:64]) - - class Meta: - ordering = ('-timestamp', )