output to console and to multiple files
goodwolf
Robert.Katic at gmail.com
Wed Feb 14 19:10:59 EST 2007
like this?
class Writers (object):
def __init__(self, *writers):
self.writers = writers
def write(self, string):
for w in self.writers:
w.write(string)
def flush(self):
for w in self.writers:
w.flush():
import sys
logfile = open('log.txt', 'w')
sys.stdout = Writers(aya.stdout, file('log.out', 'w'), logfile)
sys.stderr = Writers(aya.stdout, file('log.err', 'w'), logfile)
More information about the Python-list
mailing list