diff options
Diffstat (limited to 'src/daq/accesslog/sfive-accesslog.py')
-rwxr-xr-x | src/daq/accesslog/sfive-accesslog.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/daq/accesslog/sfive-accesslog.py b/src/daq/accesslog/sfive-accesslog.py index 03504cb..e07f22c 100755 --- a/src/daq/accesslog/sfive-accesslog.py +++ b/src/daq/accesslog/sfive-accesslog.py @@ -105,18 +105,22 @@ class AccessLog(): self._tags = properties['tags'] self._logfile = properties['logfile'] - self._initLog() - self._proto = None self._conn = None def _initLog(self): - # TODO: open file and init parser - return + try: + self._fd = open(self._logfile, 'r') + except IOError as e: + print 'SFive: error opening logfile: %s' % (e.strerror) + return False + + return True def run(self): - reactor.callWhenRunning(self._initSocket) - reactor.run() + if self._initLog(): + reactor.callWhenRunning(self._initSocket) + reactor.run() def _initSocket(self): print 'SFive: trying to connect to %s...' % (self._socket) |