Skip to content

Commit

Permalink
use custom loggers. closes gorakhargosh#274
Browse files Browse the repository at this point in the history
  • Loading branch information
tamland committed Oct 30, 2014
1 parent 2f594cc commit 5c6bc83
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/watchdog/observers/fsevents2.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
kFSEventStreamEventFlagItemIsSymlink,
)

logger = logging.getLogger(__name__)


class FSEventsQueue(Thread):
""" Low level FSEvents client. """
Expand Down Expand Up @@ -123,9 +125,9 @@ def stop(self):
def _callback(self, streamRef, clientCallBackInfo, numEvents, eventPaths, eventFlags, eventIDs):
events = [NativeEvent(path, flags, _id) for path, flags, _id in
zip(eventPaths, eventFlags, eventIDs)]
logging.debug("FSEvents callback. Got %d events:" % numEvents)
logger.debug("FSEvents callback. Got %d events:" % numEvents)
for e in events:
logging.debug(e)
logger.debug(e)
self._queue.put(events)

def read_events(self):
Expand Down
6 changes: 4 additions & 2 deletions src/watchdog/observers/inotify_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from watchdog.utils.delayed_queue import DelayedQueue
from watchdog.observers.inotify_c import Inotify

logger = logging.getLogger(__name__)


class InotifyBuffer(BaseThread):
"""A wrapper for `Inotify` that holds events for `delay` seconds. During
Expand Down Expand Up @@ -56,7 +58,7 @@ def run(self):
while self.should_keep_running():
inotify_events = self._inotify.read_events()
for inotify_event in inotify_events:
logging.debug("InotifyBuffer: in event %s", inotify_event)
logger.debug("in-event %s", inotify_event)
if inotify_event.is_moved_to:

def matching_from_event(event):
Expand All @@ -67,7 +69,7 @@ def matching_from_event(event):
if from_event is not None:
self._queue.put((from_event, inotify_event))
else:
logging.debug("InotifyBuffer: could not find matching move_from event")
logger.debug("could not find matching move_from event")
self._queue.put(inotify_event)
else:
self._queue.put(inotify_event)
Expand Down

0 comments on commit 5c6bc83

Please sign in to comment.