combox

split and encrypted files between online file storage providers
git clone git://git.ricketyspace.net/combox.git
Log | Files | Refs

commit 002c07684d97eae94881f7e45f07206ae4c6827a
parent 24eb6541326111f58b750f5be116dc66ce072bd5
Author: Siddharth Ravikumar <sravik@bgsu.edu>
Date:   Wed, 28 Jan 2015 20:08:31 -0500

combox/events.py: ComboxDirMonitor now inherits LoggingEventHandler instead of FileSystemEventHandler.

Diffstat:
combox/events.py | 23++++-------------------
1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/combox/events.py b/combox/events.py @@ -21,7 +21,7 @@ import logging from os import path -from watchdog.events import FileSystemEventHandler +from watchdog.events import LoggingEventHandler from combox.crypto import split_and_encrypt from combox.file import (mk_nodedir, rm_nodedir, rm_shards, @@ -29,7 +29,7 @@ from combox.file import (mk_nodedir, rm_nodedir, rm_shards, from combox.silo import ComboxSilo -class ComboxDirMonitor(FileSystemEventHandler): +class ComboxDirMonitor(LoggingEventHandler): """Monitors Combox directory for changes and does its crypto thing. """ @@ -38,13 +38,11 @@ class ComboxDirMonitor(FileSystemEventHandler): """ config: a dictinary which contains combox configuration. """ + super(ComboxDirMonitor, self).__init__() + self.config = config self.silo = ComboxSilo(self.config) - logging.basicConfig(level=logging.INFO, - format='%(asctime)s - %(message)s', - datefmt='%Y-%m-%d %H:%M:%S') - def housekeep(self): """Recursively traverses combox directory, discovers changes and updates silo and node directories. @@ -111,10 +109,6 @@ class ComboxDirMonitor(FileSystemEventHandler): self.silo.remove(event.src_path) self.silo.update(event.dest_path) - type_ = 'directory' if event.is_directory else 'file' - logging.info("Moved %s: from %s to %s", type_, event.src_path, - event.dest_path) - def on_created(self, event): super(ComboxDirMonitor, self).on_created(event) @@ -128,9 +122,6 @@ class ComboxDirMonitor(FileSystemEventHandler): # store file info in silo. self.silo.update(event.src_path) - type_ = 'directory' if event.is_directory else 'file' - logging.info("Created %s: %s", type_, event.src_path) - def on_deleted(self, event): super(ComboxDirMonitor, self).on_deleted(event) @@ -145,9 +136,6 @@ class ComboxDirMonitor(FileSystemEventHandler): # remove file info from silo. self.silo.remove(event.src_path) - type_ = 'directory' if event.is_directory else 'file' - logging.info("Deleted %s: %s", type_, event.src_path) - def on_modified(self, event): super(ComboxDirMonitor, self).on_modified(event) @@ -160,6 +148,3 @@ class ComboxDirMonitor(FileSystemEventHandler): split_and_encrypt(event.src_path, self.config) # update file info in silo. self.silo.update(event.src_path) - - type_ = 'directory' if event.is_directory else 'file' - logging.info("Modified %s: %s", type_, event.src_path)