Fixed log formatting in DefaultLogger.cpp to work with AssimpView.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@107 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
This commit is contained in:
aramis_acg
2008-08-11 20:57:18 +00:00
parent b5c54703d0
commit 0b1e8fefa5
4 changed files with 23 additions and 26 deletions

View File

@@ -80,8 +80,9 @@ struct LogStreamInfo
// Creates the only singleton instance
Logger *DefaultLogger::create(const std::string &name, LogSeverity severity)
{
if ( NULL == m_pLogger )
m_pLogger = new DefaultLogger( name, severity );
if (m_pLogger && !isNullLogger() )
delete m_pLogger;
m_pLogger = new DefaultLogger( name, severity );
return m_pLogger;
}
@@ -111,7 +112,7 @@ Logger *DefaultLogger::get()
// Kills the only instance
void DefaultLogger::kill()
{
ai_assert (NULL != m_pLogger);
if (m_pLogger != &s_pNullLogger)return;
delete m_pLogger;
m_pLogger = &s_pNullLogger;
}
@@ -123,7 +124,7 @@ void DefaultLogger::debug( const std::string &message )
if ( m_Severity == Logger::NORMAL )
return;
const std::string msg( "Debug, thread " + getThreadID() + " :" + message );
const std::string msg( "Debug, T" + getThreadID() + ": " + message );
writeToStreams( msg, Logger::DEBUGGING );
}
@@ -131,7 +132,7 @@ void DefaultLogger::debug( const std::string &message )
// Logs an info
void DefaultLogger::info( const std::string &message )
{
const std::string msg( "Info: " + getThreadID() + " :" + message );
const std::string msg( "Info, T" + getThreadID() + ": " + message );
writeToStreams( msg , Logger::INFO );
}
@@ -139,7 +140,7 @@ void DefaultLogger::info( const std::string &message )
// Logs a warning
void DefaultLogger::warn( const std::string &message )
{
const std::string msg( "Warn: " + getThreadID() + " :"+ message );
const std::string msg( "Warn, T" + getThreadID() + ": "+ message );
writeToStreams( msg, Logger::WARN );
}
@@ -147,7 +148,7 @@ void DefaultLogger::warn( const std::string &message )
// Logs an error
void DefaultLogger::error( const std::string &message )
{
const std::string msg( "Error: "+ getThreadID() + " :" + message );
const std::string msg( "Error, T"+ getThreadID() + ": " + message );
writeToStreams( msg, Logger::ERR );
}
@@ -232,10 +233,10 @@ DefaultLogger::DefaultLogger( const std::string &name, LogSeverity severity ) :
{
#ifdef WIN32
m_Streams.push_back( new Win32DebugLogStream() );
if (name.empty())
return;
#endif
if (name.empty())
return;
m_Streams.push_back( new FileLogStream( name ) );
}
@@ -293,7 +294,7 @@ std::string DefaultLogger::getThreadID()
if ( hThread )
{
std::stringstream thread_msg;
thread_msg << ::GetCurrentThreadId() << " ";
thread_msg << ::GetCurrentThreadId() /*<< " "*/;
return thread_msg.str();
}
else