logger caching?

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

jays
Not too shy to talk
Not too shy to talk
Posts: 27
Joined: Mon Apr 26, 2010 23:47

logger caching?

Postby jays » Mon Jun 28, 2010 18:01

I was looking at the DefaultLogger class. I notice it has an option to cache messages to a container.
I don't see any code to flush the cache to the output stream except when the file name is changed.
Is this the intended behavior? Shouldn't there be a method to flush it and flush on destruction?

Thanks
-- Doctor Doctor, it hurts when I ....

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: logger caching?

Postby Jamarr » Tue Jun 29, 2010 23:29

Hi jays, I presume the intention of caching messages was written specifically to provide a means for core CEGUI sub-systems to add messages to the log prior to the creation of the log-file. For example, the DefaultLogger's constructor logs some events prior to the log-file being opened; since the log-file (by default) is not opened until CEGUI::System's constructor is called.

Once the log-file has been opened, there is no longer a need for the caching mechanism at all. The reasoning behind this is that, if there is a fatal error that causes the application to quit unexpectedly the data within the cache would never be written to the log file, even if this where provided in the destructor; because in this case, the destructor would never be called. Thus, there was never a reason to extend the caching interface to the client.

I cannot see any benefit in adding this to the API. Caching events only serves to reduce the effectiveness of the log-file. Also, users are free to create their own derivations of the logger to suite their own needs. I believe that v0.7.0 also now provides a null-logger, which does nothing and thus produces no log-file at all. So if you really want to use caching, you only need to create a custom logger to do so.
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 5 guests