[SOLVED] Disabling log file
Posted: Mon Jan 18, 2010 19:02
Hi, I want to prevent the creation of the CEGUI log file, and I saw a post on disabling CEGUI log file creation ( viewtopic.php?f=10&t=3435&p=15557&hilit=disable+logging#p15557 ), so I followed the example code posted there and put the following in my main.cpp:
But when I do that, when exiting my app I get a failed assertion at CEGUISingleton.h, line 77:
Do I need to postpone the instantiation of my logger until a certain point or something?
Edit: I tried making my logger a member variable of my app's main class, and I still had the same problem; then I made it a pointer and instantiated it the line before creating the CEGUI renderer and system objects, and there was no assertion failure
. But this is also a memory leak, right?
And I'm just avoiding the assertion by avoiding the CEGUISingleton destructor since I never delete the logger? Or does the logger automatically get deleted, which is why it is 0 in the destructor when I don't heap-allocate it or delete it myself? 
Code: Select all
//// Disable logging in CEGUI for Release build
#ifndef _DEBUG
class CeguiNonLogger : public CEGUI::Logger{
void logEvent (const CEGUI::String&, CEGUI::LoggingLevel){}
void setLogFilename(const CEGUI::String&, bool){}
};
CeguiNonLogger g_ceguiNonLogger;
#endif
But when I do that, when exiting my app I get a failed assertion at CEGUISingleton.h, line 77:
Code: Select all
~Singleton( void )
{ assert( ms_Singleton ); ms_Singleton = 0; }
Do I need to postpone the instantiation of my logger until a certain point or something?
Edit: I tried making my logger a member variable of my app's main class, and I still had the same problem; then I made it a pointer and instantiated it the line before creating the CEGUI renderer and system objects, and there was no assertion failure


