Skip to content

Commit

Permalink
use the same format in logfile and on console and use either console …
Browse files Browse the repository at this point in the history
…or logfile
  • Loading branch information
jef-n committed Nov 27, 2011
1 parent bae8301 commit 6c90891
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/core/qgslogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}
}
Expand Down

0 comments on commit 6c90891

Please sign in to comment.