[QGIS Commit] r15158 - trunk/qgis/src/mapserver

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Feb 12 08:49:25 EST 2011


Author: jef
Date: 2011-02-12 05:49:25 -0800 (Sat, 12 Feb 2011)
New Revision: 15158

Modified:
   trunk/qgis/src/mapserver/qgis_map_serv.cpp
   trunk/qgis/src/mapserver/qgsmapserverlogger.cpp
Log:
add more debugging output to mapserver

Modified: trunk/qgis/src/mapserver/qgis_map_serv.cpp
===================================================================
--- trunk/qgis/src/mapserver/qgis_map_serv.cpp	2011-02-12 09:40:23 UTC (rev 15157)
+++ trunk/qgis/src/mapserver/qgis_map_serv.cpp	2011-02-12 13:49:25 UTC (rev 15158)
@@ -41,7 +41,31 @@
 
 void dummyMessageHandler( QtMsgType type, const char *msg )
 {
-  //be quiet
+#ifdef QGSMSDEBUG
+  QString output;
+
+  switch ( type )
+  {
+    case QtDebugMsg:
+      output += "Debug: ";
+      break;
+    case QtCriticalMsg:
+      output += "Critical: ";
+      break;
+    case QtWarningMsg:
+      output += "Warning: ";
+      break;
+    case QtFatalMsg:
+      output += "Fatal: ";
+  }
+
+  output += msg;
+
+  QgsMapServerLogger::instance()->printMessage( output );
+
+  if ( type == QtFatalMsg )
+    abort();
+#endif
 }
 
 void printRequestInfos()

Modified: trunk/qgis/src/mapserver/qgsmapserverlogger.cpp
===================================================================
--- trunk/qgis/src/mapserver/qgsmapserverlogger.cpp	2011-02-12 09:40:23 UTC (rev 15157)
+++ trunk/qgis/src/mapserver/qgsmapserverlogger.cpp	2011-02-12 13:49:25 UTC (rev 15158)
@@ -50,20 +50,27 @@
 
 void QgsMapServerLogger::printMessage( const QString& message )
 {
+  if ( !mLogFile.isOpen() )
+    return;
+
   mTextStream << message << endl;
 }
 
 void QgsMapServerLogger::printChar( QChar c )
 {
+  if ( !mLogFile.isOpen() )
+    return;
+
   mTextStream << c;
 }
 
 #ifdef QGSMSDEBUG
 void QgsMapServerLogger::printMessage( const char *file, const char *function, int line, const QString& message )
 {
-  mTextStream
-  << QString( "%1: %2: (%3) " ).arg( file ).arg( function ).arg( line )
-  << message
-  << endl;
+#if defined(_MSC_VER)
+  printMessage( QString( "%1(%2): (%3) %4" ).arg( file ).arg( line ).arg( function ).arg( line ).arg( message ) );
+#else
+  printMessage( QString( "%1: %2: (%3) %4" ).arg( file ).arg( line ).arg( function ).arg( line ).arg( message ) );
+#endif
 }
 #endif



More information about the QGIS-commit mailing list