Changing Log Filename

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

User avatar
arn
Just popping in
Just popping in
Posts: 7
Joined: Tue Jan 13, 2009 02:10

Changing Log Filename

Postby arn » Tue Jan 13, 2009 02:20

I'm trying to have my own directory where all the logging of my application is set, the same as CEGUI.log. To achieve this I have the following code:


Code: Select all

_CEGUISystem = new CEGUI::System(_ogreCEGUIRenderer);

CEGUI::Logger * log = &CEGUI::Logger::getSingleton();
log->setLogFilename(addOtherRoute("CEGUI.log"));
log->setLoggingLevel(CEGUI::Informative);


However, a CEGUI.log file is created wherever I execute my program with all the information about the creation of the System, after that, a CEGUI.log is created in the route I wanted. I'd like to avoid the first CEGUI.log. What should I do?

Thanks in advance.

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Tue Jan 13, 2009 08:39

Hi and welcome :),

you are almost there: you may use a Logger before the System exists, so you should swap the code. This is what we do for the layout editor:

Code: Select all

void CELayoutEditor::InitLogger() const
{
   // Instantiate logger first
   if (!CEGUI::Logger::getSingletonPtr())
      new CEGUI::DefaultLogger();

   // NOTE: The file will be output to the current directory (where the executable is located)
   CEGUI::Logger::getSingleton().setLogFilename("CELayoutEditor.log", false);

   // Set informative logging level
   CEGUI::Logger::getSingleton().setLoggingLevel (CEGUI::Informative);
}


HTH!
Check out my released snake game using Cegui!

User avatar
arn
Just popping in
Just popping in
Posts: 7
Joined: Tue Jan 13, 2009 02:10

Postby arn » Tue Jan 13, 2009 13:52

Thanks! It worked.

And I'm glad to be here. I think CEGUI is a very good GUI library :wink:

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Wed Jan 14, 2009 08:12

Nice that it works now. And thanks :)
Check out my released snake game using Cegui!


Return to “Help”

Who is online

Users browsing this forum: No registered users and 11 guests