add an entry for the monitor server. this value will be needed at the nodes.
[myplc.git] / mtail.py
index 1fb5b68..0e5b423 100755 (executable)
--- a/mtail.py
+++ b/mtail.py
@@ -12,7 +12,7 @@ from optparse import OptionParser
 
 class mtail:
 
-    subversion_id = "$Id: mtail.py 571 2007-06-22 21:38:07Z thierry $"
+    subversion_id = "$Id$"
 
     default_time_format = "%H:%M:%S"
     
@@ -109,7 +109,10 @@ example:
                    self.files[filename]['size']=size
                elif size < offset:
                    self.show_file_when_size_decreased(filename,offset,size)
-               del self.files[filename]['old-file']
+                try:
+                    del self.files[filename]['old-file']
+                except:
+                    pass
            else:
                # enter file with current size
                # if we didn't set format yet, it's because we are initializing
@@ -136,7 +139,11 @@ example:
            print sys.argv[0],": WARNING : no file in scope"
            self.format="%s"
        else:
-           self.margin=max(*[len(f) for f in filenames])
+           if len(filenames)==1:
+                self.margin=len(filenames[0])
+            else:
+                # this stupidly fails when there's only 1 file
+                self.margin=max(*[len(f) for f in filenames])
            self.format="%%%ds"%self.margin
            if self.options.verbose:
                print 'Current set of files:',filenames