Always timestamp log.txt.

This commit is contained in:
Glenn Maynard
2004-05-21 22:34:56 +00:00
parent f0cdbd7e4c
commit 049b31ce46
3 changed files with 13 additions and 22 deletions
+13 -19
View File
@@ -84,7 +84,6 @@ RageLog::RageLog()
m_bLogToDisk = false;
m_bInfoToDisk = false;
m_bFlush = false;
m_bTimestamping = false;
m_bShowLogOutput = false;
// delete old log files
@@ -160,11 +159,6 @@ void RageLog::SetFlushing( bool b )
m_bFlush = b;
}
void RageLog::SetTimestamping( bool b )
{
m_bTimestamping = b;
}
/* Enable or disable display of output to stdout, or a console window in Windows. */
void RageLog::SetShowLogOutput( bool show )
{
@@ -228,31 +222,33 @@ void RageLog::Write( int where, const CString &line )
if( where & WRITE_LOUD )
printf( "/////////////////////////////////////////\n" );
CString LineHeader;
if( m_bTimestamping )
LineHeader += SecondsToMMSSMsMsMs(RageTimer::GetTimeSinceStart()) + ": ";
CString sTimestamp = SecondsToMMSSMsMsMs(RageTimer::GetTimeSinceStart()) + ": ";
CString sWarning;
if( where & WRITE_LOUD )
LineHeader += "WARNING: ";
sWarning = "WARNING: ";
for( unsigned i = 0; i < lines.size(); ++i )
{
CString &str = lines[i];
if( LineHeader.size() )
str.insert( 0, LineHeader );
if( sWarning.size() )
str.insert( 0, sWarning );
if( m_bShowLogOutput || where != 0 )
printf("%s\n", str.c_str() );
if( where & WRITE_TO_INFO )
AddToInfo( str );
if( m_bLogToDisk && where&WRITE_TO_INFO && g_fileInfo->IsOpen() )
g_fileInfo->PutLine( str );
if( where & WRITE_TO_INFO )
AddToInfo( str );
/* Add a timestamp to log.txt and RecentLogs, but not the rest of info.txt
* and stdout. */
str.insert( 0, sTimestamp );
AddToRecentLogs( str );
if( m_bLogToDisk && g_fileLog->IsOpen() )
g_fileLog->PutLine( str );
if( m_bShowLogOutput || where != 0 )
printf("%s\n", str.c_str() );
}
if( m_bLogToDisk && g_fileLog->IsOpen() && (where & WRITE_LOUD) )
@@ -371,8 +367,6 @@ const char *RageLog::GetAdditionalLog()
void RageLog::MapLog(const CString &key, const char *fmt, ...)
{
CString s;
if( m_bTimestamping )
s += SecondsToMMSSMsMsMs(RageTimer::GetTimeSinceStart()) + ": ";
va_list va;
va_start(va, fmt);
-2
View File
@@ -28,13 +28,11 @@ public:
void SetLogToDisk( bool b ); // enable or disable logging to file
void SetInfoToDisk( bool b ); // enable or disable logging info.txt to file
void SetFlushing( bool b ); // enable or disable flushing
void SetTimestamping( bool b ); // enable or disable timestamping
private:
bool m_bLogToDisk;
bool m_bInfoToDisk;
bool m_bFlush;
bool m_bTimestamping;
bool m_bShowLogOutput;
void Write( int, const CString &str );
void UpdateMappedLog();
-1
View File
@@ -864,7 +864,6 @@ static void ApplyLogPreferences()
LOG->SetLogToDisk( PREFSMAN->m_bLogToDisk );
LOG->SetInfoToDisk( true );
LOG->SetFlushing( PREFSMAN->m_bForceLogFlush );
LOG->SetTimestamping( PREFSMAN->m_bTimestamping );
Checkpoints::LogCheckpoints( PREFSMAN->m_bLogCheckpoints );
}