<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,27 +1,33 @@
 import datetime
 import logging
-
+import optparse
 from django.conf import settings
 from django.contrib.auth.models import User
-from django.core.management.base import NoArgsCommand
+from django.core.management.base import BaseCommand
 from djumblr.models import Regular, Photo, Quote, Link, Conversation, Audio, Video, ConversationLine, TumbleItem
 from tumblr import Api
 
 
-LOG_LEVEL = logging.DEBUG
-#LOG_LEVEL = logging.WARN
-logging.basicConfig(
-    level=LOG_LEVEL,
-    format=&quot;%(asctime)s - %(name)s - %(levelname)s - %(message)s&quot;
-)
-
-
-class Command(NoArgsCommand):
+class Command(BaseCommand):
     help = &quot;&quot;
-
-    def __init__(self, *args, **kwargs):
-        super(Command, self).__init__(*args, **kwargs)
+    option_list = BaseCommand.option_list + (
+        optparse.make_option(
+            &quot;-u&quot;, &quot;--user&quot;, 
+            dest=&quot;user&quot;, 
+            action=&quot;store&quot;, 
+            help=&quot;Sync tumblr with a given username&quot;
+        ),
+    )
+
+    def handle(self, *args, **options):
+        level = {
+            '0': logging.WARN, 
+            '1': logging.INFO, 
+            '2': logging.DEBUG
+        }[options.get('verbosity', '0')]
+        logging.basicConfig(level=level, format=&quot;%(name)s: %(levelname)s: %(message)s&quot;)
         self.log = logging.getLogger('djumblr.management.commands.sync_tumblr')
+        self.populate_all()
 
     def handle_noargs(self, **options):
         self.populate_all()
@@ -38,7 +44,7 @@ class Command(NoArgsCommand):
             tumblr_id = tumbl['id']
             pub_date = datetime.datetime.strptime(tumbl['date-gmt'], '%Y-%m-%d %H:%M:%S %Z')
 
-            self.log.debug('%s' % (tumblr_id))
+            self.log.debug('%s (%s)' % (tumblr_id, tumbl['type']))
 
             try:
                 TumbleItem.objects.get(tumblr_id=tumblr_id)
@@ -114,8 +120,7 @@ class Command(NoArgsCommand):
 
                     # TODO: Raise error.
                     else:
-                        print &quot;ERROR!&quot;, tumbl
-                        return ''
+                        self.log.error('Type does not exist: %s' % (tumbl['type']))
 
                     m.save()
 </diff>
      <filename>djumblr/management/commands/sync_tumblr.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>78761a6d287108ca9286473263d99fcbbd167cdd</id>
    </parent>
  </parents>
  <author>
    <name>Jeff Triplett</name>
    <email>jeff.triplett@gmail.com</email>
  </author>
  <url>http://github.com/jefftriplett/django-tumblr/commit/0885f4778390fd59861b9e4271caad80501ba4fc</url>
  <id>0885f4778390fd59861b9e4271caad80501ba4fc</id>
  <committed-date>2009-10-06T22:16:30-07:00</committed-date>
  <authored-date>2009-10-06T22:16:30-07:00</authored-date>
  <message>updated the sync_tumblr management command to allow arguments. borrowed a trick
from jellyroll on the verbosity levels</message>
  <tree>da49608736765fe10a943b5cca241a7c95b48107</tree>
  <committer>
    <name>Jeff Triplett</name>
    <email>jeff.triplett@gmail.com</email>
  </committer>
</commit>
