Package PyFoam :: Package Execution :: Module BasicWatcher :: Class BasicWatcher
[show private | hide private]
[frames | no frames]

Class BasicWatcher

Known Subclasses:
AnalyzedWatcher, GnuplotWatcher, StepAnalyzedWatcher

Base class for watching the output of commands

Works like the UNIX-command 'tail -f <file>': the last lines of the file are output. If the file grows then these lines are output as they arrive
Method Summary
  __init__(self, filename, silent, tailLength, sleep)
  getSize(self)
Return the current size (in bytes) of the file
  lineHandle(self, line)
called every time a new line is read
  start(self)
Reads the file and does the processing
  startHandle(self)
to be called before the program is started
  stopHandle(self)
called after the program has stopped
  tailingHandle(self)
called when the first line is output

Method Details

__init__(self, filename, silent=False, tailLength=1000, sleep=0.10000000000000001)
(Constructor)

Parameters:
filename - name of the logfile to watch
silent - if True no output is sent to stdout
tailLength - number of bytes at the end of the fail that should be output. Because data is output on a per-line-basis
sleep - interval to sleep if no line is returned

getSize(self)

Returns:
the current size (in bytes) of the file

lineHandle(self, line)

called every time a new line is read

start(self)

Reads the file and does the processing

startHandle(self)

to be called before the program is started

stopHandle(self)

called after the program has stopped

tailingHandle(self)

called when the first line is output

Generated by Epydoc 2.1 on Mon Jan 22 23:52:48 2007 http://epydoc.sf.net