Redirecting standard out in a single namespace
Pan Menghan
nirvana117 at gmail.com
Mon Jan 23 06:05:27 EST 2006
Maybe you can use __name__ to determine which module the print statement is
in:
class out:
def write(s,a):
if __name__ =="myModule":
mylog.write(a)
else:
sys.__stdout__.write(a)
sys.stdout = out()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060123/ff245a24/attachment.html>
More information about the Python-list
mailing list