<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>LICENSE</filename>
    </added>
    <added>
      <filename>djangodblog/manager.py</filename>
    </added>
    <added>
      <filename>djangodblog/tests.py</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -31,17 +31,65 @@ Once installed, update your settings.py and add the middleware and installed app
 
 Finally, run ``python manage.py syncdb`` to create the database tables.
 
+Configuration
+=============
+
+Several options exist to configure django-db-log via your ``settings.py``:
+
+DBLOG_CATCH_404_ERRORS
+######################
+
+Enable catching of 404 errors in the logs. Default value is ``False``.
+
+DBLOG_DATABASE
+##############
+
+Warning: This feature is currently in the testing phase.
+
+Use a secondary database to store error logs. This is useful if you have several websites and want to aggregate error logs onto one database server::
+
+	DBLOG_DATABASE = dict(
+	    DATABASE_ENGINE='mysql', # defaults to settings.DATABASE_ENGINE
+	    DATABASE_NAME='my_db_name',
+	    DATABASE_USER='db_user',
+	    DATABASE_PASSWORD='db_pass',
+	    DATABASE_HOST='localhost', # defaults to localhost
+	    DATABASE_PORT='', # defaults to [default port]
+	    DATABASE_OPTIONS={}
+	)
+
+Some things to note:
+
+* You will need to create the tables by hand if you use this option. Use ``python manage.py sql djangodblog`` and dump that SQL into the correct server.
+* This functionality does not yet support Django 1.2.
+
 Usage
 =====
 
 You will find two new admin panels in the automatically built Django administration:
 
-* Errors
-* Error batchs
+* Errors (Error)
+* Error batches (ErrorBatch)
+
+It will store every single error inside of the `Errors` model, and it will store a collective, or summary, of errors inside of `Error batches` (this is more useful for most cases). If you are using this on multiple sites with the same database, the `Errors` table also contains the SITE_ID for which it the error appeared on.
+
+If you wish to access these within your own views and models, you may do so via the standard model API::
+
+	from djangodblog.models import Error, ErrorBatch
+	
+	ErrorBatch.objects.all().order_by('-last_seen')
+
+You can also record errors outside of middleware if you want::
 
-It will store every single error inside of the `Errors` model, and it will store a collective, or summary, of errors inside of `Error batchs` (this is more useful for most cases).
+	from djangodblog.models import Error
+	
+	try:
+		...
+	except Exception, exc:
+		Error.objects.create_from_exception(exc, [url=None])
 
 Notes
 =====
 
-* django-db-log will automatically integrate with django-idmapper
\ No newline at end of file
+* django-db-log will automatically integrate with django-idmapper.
+* Multi-db support (via ``DBLOG_DATABASE``) will most likely not work in Django 1.2
\ No newline at end of file</diff>
      <filename>README.rst</filename>
    </modified>
    <modified>
      <diff>@@ -1 +1 @@
-__version__ = (1, 1, 0)
\ No newline at end of file
+__version__ = (1, 2, 0)
\ No newline at end of file</diff>
      <filename>djangodblog/__init__.py</filename>
    </modified>
    <modified>
      <diff>@@ -1,48 +1,13 @@
-import traceback
-import socket
-import warnings
-import datetime
-
 from django.conf import settings
 from django.http import Http404
-from django.utils.hashcompat import md5_constructor
-from django.utils.encoding import smart_unicode
-
-from djangodblog.models import Error, ErrorBatch
 
-__all__ = ('DBLogMiddleware', 'DBLOG_CATCH_404_ERRORS')
+from djangodblog.models import Error
 
-DBLOG_CATCH_404_ERRORS = getattr(settings, 'DBLOG_CATCH_404_ERRORS', False)
+__all__ = ('DBLogMiddleware',)
 
 class DBLogMiddleware(object):
     def process_exception(self, request, exception):
-        if not DBLOG_CATCH_404_ERRORS and isinstance(exception, Http404):
+        if not getattr(settings, 'DBLOG_CATCH_404_ERRORS', False) and isinstance(exception, Http404):
             return
-        server_name = socket.gethostname()
-        tb_text     = traceback.format_exc()
-        class_name  = exception.__class__.__name__
-        checksum    = md5_constructor(tb_text).hexdigest()
-
-        defaults = dict(
-            class_name  = class_name,
-            message     = smart_unicode(exception),
-            url         = request.build_absolute_uri(),
-            server_name = server_name,
-            traceback   = tb_text,
-        )
 
-        try:
-            Error.objects.create(**defaults)
-            batch, created = ErrorBatch.objects.get_or_create(
-                class_name = class_name,
-                server_name = server_name,
-                checksum = checksum,
-                defaults = defaults
-            )
-            if not created:
-                batch.times_seen += 1
-                batch.resolved = False
-                batch.last_seen = datetime.datetime.now()
-                batch.save()
-        except Exception, exc:
-            warnings.warn(smart_unicode(exc))
\ No newline at end of file
+        Error.objects.create_from_exception(exception, url=request.build_absolute_uri())
\ No newline at end of file</diff>
      <filename>djangodblog/middleware.py</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,7 @@
 from django.db import models
+from django.conf import settings
 from django.utils.translation import ugettext_lazy as _
+
 try:
     from idmapper.models import SharedMemoryModel as Model
 except ImportError:
@@ -7,6 +9,8 @@ except ImportError:
 
 import datetime
 
+from manager import DBLogManager
+
 __all__ = ('Error', 'ErrorBatch')
 
 class ErrorBatch(Model):
@@ -21,9 +25,14 @@ class ErrorBatch(Model):
     server_name     = models.CharField(max_length=128, db_index=True)
     checksum        = models.CharField(max_length=32, db_index=True)
 
+    objects         = DBLogManager()
+
     class Meta:
         unique_together = (('class_name', 'server_name', 'checksum'),)
         verbose_name_plural = 'Error batches'
+    
+    def __unicode__(self):
+        return &quot;(%s) %s: %s&quot; % (self.times_seen, self.class_name, self.message)
 
 class Error(Model):
     class_name      = models.CharField(_('type'), max_length=128)
@@ -31,4 +40,9 @@ class Error(Model):
     traceback       = models.TextField()
     datetime        = models.DateTimeField(default=datetime.datetime.now)
     url             = models.URLField(verify_exists=False, null=True, blank=True)
-    server_name     = models.CharField(max_length=128, db_index=True)
\ No newline at end of file
+    server_name     = models.CharField(max_length=128, db_index=True)
+
+    objects         = DBLogManager()
+
+    def __unicode__(self):
+        return &quot;%s: %s&quot; % (self.class_name, self.message)
\ No newline at end of file</diff>
      <filename>djangodblog/models.py</filename>
    </modified>
    <modified>
      <diff>@@ -6,9 +6,9 @@ import djangodblog
 
 setup(
     name='django-db-log',
-    version=&quot;.&quot;.join(map(str, djangodblog.__version__)),
-    author=&quot;David Cramer&quot;,
-    author_email=&quot;dcramer@gmail.com&quot;,
+    version='.'.join(map(str, djangodblog.__version__)),
+    author='David Cramer',
+    author_email='dcramer@gmail.com',
     url='http://github.com/dcramer/django-db-log',
     install_requires=[
         'Django&gt;=1.0'
@@ -17,10 +17,10 @@ setup(
     packages=find_packages(),
     include_package_data=True,
     classifiers=[
-        &quot;Framework :: Django&quot;,
-        &quot;Intended Audience :: Developers&quot;,
-        &quot;Intended Audience :: System Administrators&quot;,
-        &quot;Operating System :: OS Independent&quot;,
-        &quot;Topic :: Software Development&quot;
+        'Framework :: Django',
+        'Intended Audience :: Developers',
+        'Intended Audience :: System Administrators',
+        'Operating System :: OS Independent',
+        'Topic :: Software Development'
     ],
 )
\ No newline at end of file</diff>
      <filename>setup.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>4ae40c735e60c650896faf46767005b6cf3d4789</id>
    </parent>
  </parents>
  <author>
    <name>David Cramer</name>
    <email>dcramer@David-Cramers-MacBook.local</email>
  </author>
  <url>http://github.com/dcramer/django-db-log/commit/583bcd85e07eeb42d6767761afdc95ece78cc6e9</url>
  <id>583bcd85e07eeb42d6767761afdc95ece78cc6e9</id>
  <committed-date>2009-11-09T14:21:50-08:00</committed-date>
  <authored-date>2009-11-09T14:21:50-08:00</authored-date>
  <message>Added DBLOG_DATABASE setting for multi-db</message>
  <tree>ff8eea24f6e75a19c217630c2351d978b5508872</tree>
  <committer>
    <name>David Cramer</name>
    <email>dcramer@David-Cramers-MacBook.local</email>
  </committer>
</commit>
