Dear John,
I would like to use the Logog in a fashoin that would permit presering (almost) all of the log messages in the case the code crashes. For example, I can keep a buffer and dump it to file once in 500 ms.
I have tried the following code (borrowed in parts from the unitest)
LOGOG_INITIALIZE();
{
LogFile logFile( "log.txt" );
LogBuffer logBuffer( &logFile );
logBuffer.SetNullTerminatesStrings( false );
logFile.UnsubscribeToMultiple( AllFilters() );
Formatter *pFormatter = &GetDefaultFormatter();
pFormatter->SetShowTimeOfDay( true );
ERR( _LG( "This is an error") );
DBUG( _LG( "This is debugging info ",) );
logBuffer.Dump();
WARN("a WARNING MESSAGE WITH number %.3f", 0.43543);
logBuffer.Dump();
}
LOGOG_SHUTDOWN();
I would expect the logBuffer.Dump(); to save the first two errors to the file, but the file only appears to get filled with content when the whole program finishes. If the program crashes after a the first .Dump(), nothing is saved (I use 'break' in Debug mode to simulate the crash). What happens when the .Dump() is called?
Thank you,
Joseph Shtok