How to disable/redirect cout/cerrr

pepere

06-02-2010 11:38:24

Hello,

I'm running my pyogre script in a command shell under windows.
Currently I got a really boring issue because my graphic card has lot of options and it takes like 5 seconds to launch my app everytime.
(due to terminal output overflooded by logging text)
I just discovered that doing:

test.py 2>&0

redirect all C++ layer output to nowhere and my app startup instantaneously.

Is there a way to enable this with the python script?
(I've tried with sys module without succes...)

thx!

pepere

20-02-2010 17:24:41

Ha found a solution in the code snippets...

class MyLog(ogre.LogListener):
"""
Creates a C++ log that will try and write to console and file
"""

def messageLogged(self, message, level, debug, logName):
# This should be called by Ogre instead of logging
#print str(level)+':'+str(debug)+':'+logName+':'+message
pass

class QtOgreWidget(QtGui.QWidget):
def _ogreLogInit(self):
self.log_manager = ogre.LogManager()
# create a "log"
currentLog = self.log_manager.createLog("start.log",
True, # it's the default log
False, # I don't want it sent to the debug window
False, # it's a virtual log, so you need a listener :)
)
# register our listener
currentLog.addListener(self._ogre_log)