diff options
author | Christian Pointner <equinox@spreadspace.org> | 2014-10-12 20:31:45 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2014-10-12 20:31:45 +0200 |
commit | 9e6e1328325a4ea98828fc8071587b27e16954cd (patch) | |
tree | 6da11654971c72d59eb2c92febc20d8e67af1ff8 /src | |
parent | added inital version for accesslog importer (diff) |
open log file
Diffstat (limited to 'src')
-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) |