add debug logging to win32 filemon
This commit is contained in:
parent
3fd052b169
commit
531d3d830e
1 changed files with 13 additions and 3 deletions
|
@ -31,6 +31,7 @@ import sys
|
||||||
import socket
|
import socket
|
||||||
import time
|
import time
|
||||||
import Queue
|
import Queue
|
||||||
|
import logging
|
||||||
from traceback import format_exception
|
from traceback import format_exception
|
||||||
|
|
||||||
import edbob
|
import edbob
|
||||||
|
@ -46,6 +47,9 @@ if sys.platform == 'win32': # docs should build for everyone
|
||||||
import win32api
|
import win32api
|
||||||
|
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class FileMonitorService(win32serviceutil.ServiceFramework):
|
class FileMonitorService(win32serviceutil.ServiceFramework):
|
||||||
"""
|
"""
|
||||||
Implements edbob's file monitor Windows service.
|
Implements edbob's file monitor Windows service.
|
||||||
|
@ -80,9 +84,14 @@ class FileMonitorService(win32serviceutil.ServiceFramework):
|
||||||
self.monitored = {}
|
self.monitored = {}
|
||||||
monitored = edbob.config.require('edbob.filemon', 'monitored')
|
monitored = edbob.config.require('edbob.filemon', 'monitored')
|
||||||
monitored = monitored.split(',')
|
monitored = monitored.split(',')
|
||||||
for m in monitored:
|
for key in monitored:
|
||||||
m = m.strip()
|
key = key.strip()
|
||||||
self.monitored[m] = MonitorProfile(m)
|
profile = MonitorProfile(key)
|
||||||
|
self.monitored[key] = profile
|
||||||
|
log.debug("Monitoring profile '%s': %s" % (key, profile.dirs))
|
||||||
|
for path in profile.dirs:
|
||||||
|
if not os.path.exists(path):
|
||||||
|
log.warning("Path does not exist: %s" % path)
|
||||||
queue = Queue.Queue()
|
queue = Queue.Queue()
|
||||||
|
|
||||||
for key in self.monitored:
|
for key in self.monitored:
|
||||||
|
@ -95,6 +104,7 @@ class FileMonitorService(win32serviceutil.ServiceFramework):
|
||||||
except Queue.Empty:
|
except Queue.Empty:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
log.debug("Got notification: %s, %s, %s" % (key, ftype, fpath))
|
||||||
# if ftype == 'file' and action in (
|
# if ftype == 'file' and action in (
|
||||||
# ACTION_CREATE, ACTION_UPDATE):
|
# ACTION_CREATE, ACTION_UPDATE):
|
||||||
if ftype == 'file' and action == ACTION_CREATE:
|
if ftype == 'file' and action == ACTION_CREATE:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue