Saturday, February 14, 2004

Python Plumber's Helpers: "Logger.py: This module provides a convenient file-like object (writing only) which dates output lines automatically.
There is also a public function, logtime(), which returns the current date in the format used by the LogFile class. "



import sys
from Logger import LogFile
sys.stderr = LogFile(open("example.log", "a"))


"NWayOutput: This module implements a class, NWayOutput, which must be instantiated with one or more file-like objects (capable of write). The file-like objects may be given as a tuple, list, or as multiple arguments. "



import sys
from NWayOutput import NWayOutput
sys.stderr = NWayOutput(sys.stderr, open("logfile.txt", "w"))