--- a/pvl/syslog/tail.py Fri Jan 04 21:15:42 2013 +0200
+++ b/pvl/syslog/tail.py Fri Jan 04 21:26:39 2013 +0200
@@ -15,8 +15,11 @@
Works with python file objects that buffer readlines() when using e.g. `tail -f ... | python -u ...`.
"""
- def __init__ (self, file) :
+ def __init__ (self, file, skip=None) :
self.file = file
+
+ if skip :
+ self.skip()
def readline (self) :
"""
@@ -65,9 +68,16 @@
Follow a file on the filesystem, reading lines until EOF, and re-opening if replaced.
"""
- def __init__ (self, path) :
+ def __init__ (self, path, **opts) :
+ log.debug("%s", path)
+
self.path = path
- self.reopen()
+ self._stat = self.stat()
+
+ file = self.open()
+
+ # may call skip -> readlines -> changed() -> _stat
+ Tail.__init__(self, file, **opts)
def stat (self) :
"""