pvl.syslog.SyslogSource: close + __str__
authorTero Marttila <terom@paivola.fi>
Sun, 13 Jan 2013 13:04:51 +0200
changeset 139 515b74c6b456
parent 138 e10e473902cb
child 140 84b6db638131
pvl.syslog.SyslogSource: close + __str__
pvl/socket.py
pvl/syslog/syslog.py
--- a/pvl/socket.py	Sun Jan 13 12:59:05 2013 +0200
+++ b/pvl/socket.py	Sun Jan 13 13:04:51 2013 +0200
@@ -229,6 +229,8 @@
             Line is returned without trailing '\r\n' or '\n'.
 
             Returns None if there is no line available.
+
+            XXX: trailing data in buf when _read() raises EOFError?
         """
 
         while '\n' not in self._buf :
@@ -263,7 +265,6 @@
             line = self.readline()
 
             if line is None :
-                # no more
                 return
             else :
                 yield line
--- a/pvl/syslog/syslog.py	Sun Jan 13 12:59:05 2013 +0200
+++ b/pvl/syslog/syslog.py	Sun Jan 13 13:04:51 2013 +0200
@@ -112,3 +112,15 @@
 
         log.debug("exit")
 
+    def close (self) :
+        """
+            Close the syslog source, if possible.
+
+        """
+
+        # XXX: do all sources support close?
+        self.source.close()
+
+    def __str__ (self) :
+        return ' | '.join((str(self.source), str(self.parser), str(self.filter)))
+