changeset 38:c14cfd6be87a

Added basic logging to settings.py. The send_email function is now logging. Removed remnants of the DebugLog model.
author Brian Neal <bgneal@gmail.com>
date Thu, 11 Jun 2009 01:33:38 +0000
parents 91fd31dc78fb
children 5dbfb7fec629
files gpp/core/admin.py gpp/core/functions.py gpp/settings.py
diffstat 3 files changed, 18 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/gpp/core/admin.py	Thu Jun 11 01:00:31 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-"""This file contains the automatic admin site definitions for the core Models"""
-
-from django.contrib import admin
-from core.models import DebugLog
-
-class DebugLogAdmin(admin.ModelAdmin):
-    list_display = ('__unicode__', 'level')
-    ordering = ('-timestamp', )
-    date_hierarchy = 'timestamp'
-
-admin.site.register(DebugLog, DebugLogAdmin)
-
-# vim: ts=4 sw=4
--- a/gpp/core/functions.py	Thu Jun 11 01:00:31 2009 +0000
+++ b/gpp/core/functions.py	Thu Jun 11 01:33:38 2009 +0000
@@ -16,8 +16,9 @@
         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))
+    import logging
+    logging.debug('EMAIL:\nFrom: %s\nTo: %s\nSubject: %s\nMessage:\n%s' %
+            (from_email, str(recipient_list), subject, message))
 
 
 def email_admins(subject, message):
--- a/gpp/settings.py	Thu Jun 11 01:00:31 2009 +0000
+++ b/gpp/settings.py	Thu Jun 11 01:33:38 2009 +0000
@@ -2,8 +2,10 @@
 
 import os
 import platform
+from decimal import Decimal
+import logging
+
 import local_settings
-from decimal import Decimal
 
 project_path = os.path.abspath(os.path.split(__file__)[0])
 
@@ -157,6 +159,18 @@
 DONATIONS_ITEM_NUM = 500            # donation w/name listed
 DONATIONS_ITEM_ANON_NUM = 501       # donation listed as anonymous
 
+#######################################################################
+# Configure Logging
+#######################################################################
+
+logging.basicConfig(
+        filename=os.path.join(project_path, 'logs', 'gpp.log'),
+        filemode='a',
+        format='%(asctime)s %(levelname)s %(message)s',
+        level=local_settings.LOG_LEVEL)
+
+
+#######################################################################
 # URL's of 3rd party Javascript and CSS files.
 # These dictionaries are used by core/templatetags/script_tags, and
 # should also be used by developers when creating form media classes.