Logging Panda3d text output

Greetings everyone!

I’m trying to create an error logger to catch all the messages my Panda3d session sends to one file (essentially, a good ol’ “remap stdout, stderr”). I tried this little nugget of code from a Python forum:

sys.stdout = open("out.txt","w")
sys.stderr = sys.stdout

That seems to have worked correctly for all the “print” statements in my program. Unfortunately, it still doesn’t catch error messages coming from Panda3d’s components, such as:

:pnmimage:tiff(warning): TIFF file: unknown field with tag 37724 (0x935c) encountered
:gobj(error): Texture::read() - couldn't read: textures/glyph_of_madness.jpg

Does anyone know what additional steps I need to take to capture these error messages as well?

Thanks!

-Mark

Try this:

nout = MultiplexStream()
Notify.ptr().setOstreamPtr(nout, 0)
nout.addFile(Filename("out.txt"))

David

That’s got it!

Thank you greatly for the help!

-Mark

I just created a manual entry for “Log Messages.” I wrote what little I know, plus this little snippet.

It would be very useful if manual sections could have some sort of indication that they’re new or recently edited. A ‘recently changed’ list would be fine.

Have you seen this page?

David

ah good, I knew it should have been there somewhere, but I didn’t see a link anywhere. Thanks.