Skip to content
Permalink
Browse files
use the same format in logfile and on console and use either console …
…or logfile
  • Loading branch information
jef-n committed Nov 27, 2011
1 parent bae8301 commit 6c908910fdd017204fb14a755c887604174f8493
Showing with 17 additions and 11 deletions.
  1. +17 −11 src/core/qgslogger.cpp
@@ -36,29 +36,35 @@ void QgsLogger::debug( const QString& msg, int debuglevel, const char* file, con
int dlevel = debugLevel();
if ( dlevel >= debuglevel && debuglevel > 0 )
{
if ( file == NULL )
QString m;

if ( !file )
{
qDebug( "%s", msg.toLocal8Bit().constData() );
logMessageToFile( msg );
m = msg;
}
else if ( function == NULL )
else if ( !function )
{
qDebug( "%s: %s", file, msg.toLocal8Bit().constData() );
logMessageToFile( msg );
m = QString( "%1: %2" ).arg( file ).arg( msg );
}
else if ( line == -1 )
{
qDebug( "%s: (%s) %s", file, function, msg.toLocal8Bit().constData() );
logMessageToFile( msg );
m = QString( "%1: (%2) %3" ).arg( file ).arg( function ).arg( msg );
}
else
{
#ifndef _MSC_VER
qDebug( "%s: %d: (%s) %s", file, line, function, msg.toLocal8Bit().constData() );
m = QString( "%1: %2: (%3) %4" ).arg( file ).arg( line ).arg( function ).arg( msg );
#else
qDebug( "%s(%d) : (%s) %s", file, line, function, msg.toLocal8Bit().constData() );
m = QString( "%1(%2) : (%3) %4" ).arg( file ).arg( line ).arg( function ).arg( msg );
#endif
logMessageToFile( msg );
}
if ( logFile().isEmpty() )
{
qDebug( "%s", m.toLocal8Bit().constData() );
}
else
{
logMessageToFile( m );
}
}
}

0 comments on commit 6c90891

Please sign in to comment.