anuga.utilities.log.TeeStream

class anuga.utilities.log.TeeStream(logfile_path, mode='a')[source]

Bases: object

Tee sys.stdout to a file: every write goes to both terminal and file.

Usage:

sys.stdout = TeeStream(‘run.log’) # From now on, print() and sys.stdout.write() go to both places. sys.stdout.close() # when done (optional)

__init__(logfile_path, mode='a')[source]

Methods

__init__(logfile_path[, mode])

close()

flush()

write(message)