naf4ever
Dread Lord
TheLopez said:naf4ever that is good but this gives you a lot more flexibility.
Basically this is a file almost completely gutted except for the important code and example. Lets call this file CvFoo.py.
Code:# Import statements # ... # ... # Global variables # ... # ... # Change this to enable or disable debug messages g_bDebug = true LOG_ONLY = 1 SCREEN_ONLY = 2 LOG_AND_SCREEN = 3 # Change to redirect the debug messages to the logs, screen or both. g_iDebugMessageTarget = LOG_ONLY class CvFoo: def fooBar(self): # Debug code - Start if(g_bDebug): self.printDebugMessage("Hello, World!") # Debug code - End return iHangingBodyCount # Prints the debug message to the logs, screen or both def printDebugMessage(self, strMessage): if(g_iDebugMessageTarget == LOG_ONLY): CvUtil.pyPrint(strMessage) elif(g_iDebugMessageTarget == SCREEN_ONLY): CyInterface().addImmediateMessage(strMessage) else: CvUtil.pyPrint(strMessage) CyInterface().addImmediateMessage(strMessage)
Hmm... I guess i meant mine for use mainly for when there are no coding errors. When the code is correct but the problem is some loop or incorrect variable being called up, which happens to me a lot. This way i can print its value to see whats going.
Can you explain what yours here does more? How does it differ from the python popup message i get when im in toggle.gamedebugmode ?