Skip to content

Commit 55cd73d

Browse files
author
jef
committedFeb 12, 2011
add more debugging output to mapserver
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15158 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

2 files changed

+36
-5
lines changed

2 files changed

+36
-5
lines changed
 

‎src/mapserver/qgis_map_serv.cpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,31 @@ map service syntax for SOAP/HTTP POST
4141

4242
void dummyMessageHandler( QtMsgType type, const char *msg )
4343
{
44-
//be quiet
44+
#ifdef QGSMSDEBUG
45+
QString output;
46+
47+
switch ( type )
48+
{
49+
case QtDebugMsg:
50+
output += "Debug: ";
51+
break;
52+
case QtCriticalMsg:
53+
output += "Critical: ";
54+
break;
55+
case QtWarningMsg:
56+
output += "Warning: ";
57+
break;
58+
case QtFatalMsg:
59+
output += "Fatal: ";
60+
}
61+
62+
output += msg;
63+
64+
QgsMapServerLogger::instance()->printMessage( output );
65+
66+
if ( type == QtFatalMsg )
67+
abort();
68+
#endif
4569
}
4670

4771
void printRequestInfos()

‎src/mapserver/qgsmapserverlogger.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,27 @@ int QgsMapServerLogger::setLogFilePath( const QString& path )
5050

5151
void QgsMapServerLogger::printMessage( const QString& message )
5252
{
53+
if ( !mLogFile.isOpen() )
54+
return;
55+
5356
mTextStream << message << endl;
5457
}
5558

5659
void QgsMapServerLogger::printChar( QChar c )
5760
{
61+
if ( !mLogFile.isOpen() )
62+
return;
63+
5864
mTextStream << c;
5965
}
6066

6167
#ifdef QGSMSDEBUG
6268
void QgsMapServerLogger::printMessage( const char *file, const char *function, int line, const QString& message )
6369
{
64-
mTextStream
65-
<< QString( "%1: %2: (%3) " ).arg( file ).arg( function ).arg( line )
66-
<< message
67-
<< endl;
70+
#if defined(_MSC_VER)
71+
printMessage( QString( "%1(%2): (%3) %4" ).arg( file ).arg( line ).arg( function ).arg( line ).arg( message ) );
72+
#else
73+
printMessage( QString( "%1: %2: (%3) %4" ).arg( file ).arg( line ).arg( function ).arg( line ).arg( message ) );
74+
#endif
6875
}
6976
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.