Reduce verbosity of commands
This commit is contained in:
parent
ee2856c5fc
commit
fccf5ff600
|
@ -56,6 +56,6 @@ def handle_lock(handle):
|
|||
lock.release()
|
||||
logging.debug("released.")
|
||||
|
||||
logging.info("done in %.2f seconds" % (time.time() - start_time))
|
||||
logging.debug("done in %.2f seconds" % (time.time() - start_time))
|
||||
|
||||
return wrapper
|
||||
|
|
|
@ -14,22 +14,17 @@ class Command(BaseCommand):
|
|||
def handle(self, *args, **options):
|
||||
logger = logging.getLogger("davinci.icalendar.ical_sync")
|
||||
logger.debug(f"Command `ical_sync` invoked")
|
||||
self.stdout.write(f"Command `ical_sync` invoked")
|
||||
|
||||
for sync in ICalSync.objects.filter(active=True):
|
||||
sync: ICalSync
|
||||
if sync.last_sync is None or timezone.now() > (sync.last_sync + sync.sync_interval):
|
||||
logger.debug(f"Synchronizing {sync.name}...")
|
||||
self.stdout.write(f"Synchronizing {sync.name}...")
|
||||
|
||||
events = sync.get_events()
|
||||
added, existing, deleted = sync.target.upload_events(events, purge=sync.purge)
|
||||
|
||||
sync.last_sync = timezone.now()
|
||||
sync.save()
|
||||
msg = f"Sync for {sync.name} done! {added} events added, {existing} updated, and {deleted} purged."
|
||||
logger.info(msg)
|
||||
self.stdout.write(msg)
|
||||
logger.debug(f"Sync for {sync.name} done! {added} events added, {existing} updated, and {deleted} purged.")
|
||||
|
||||
self.stdout.write("iCal sync complete!")
|
||||
logger.debug("iCal sync complete!")
|
||||
|
|
Loading…
Reference in a new issue