[bfprog] OS Module Nerfed, Plus
ScratchMonkey
ScratchMonkey at MatureAsskickers.net
Fri Jun 24 15:34:23 PDT 2005
--On Friday, June 24, 2005 12:30 PM -0600 Forrest Thiessen
<thiessen at cyberscapearena.com> wrote:
> I think this is best handled by a plug-in. It's easy to do, just four
> lines:
> import sys
> logFile = open('mylog.log', 'a')
> sys.stdout = logFile
> sys.stderr = logFile
>
> Put this in a .py file, drop it in the "custom" directory (and maybe
> register it, as described above), and you've got a debugging logging
> facility.
I'd recommend making it work like "tee", so that it adds a new sink to the
outputs, rather than replacing them. That way the output continues to go to
the console.
It might be better to create a publisher module that initially subscribes
the existing stdout and stderr but allows other sources (eg. rcon
terminals) to subscribe. Strings sent to this module go out to all
subscribers.
More information about the BFProg
mailing list