27 #define QgsDebugMsg(str) QgsLogger::debug(QString(str), 1, __FILE__, __FUNCTION__, __LINE__)
28 #define QgsDebugMsgLevel(str, level) \
30 if ( QgsLogger::debugLevel() >= (level) && (level) > 0 ) \
31 QgsLogger::debug(QString(str), (level), __FILE__, __FUNCTION__, __LINE__); \
33 #define QgsDebugCall QgsScopeLogger _qgsScopeLogger(__FILE__, __FUNCTION__, __LINE__)
36 #define QgsDebugMsg(str)
37 #define QgsDebugMsgLevel(str, level)
66 static void debug(
const QString& msg,
int debuglevel = 1,
const char*
file = NULL,
const char*
function = NULL,
int line = -1 );
69 static void debug(
const QString& var,
int val,
int debuglevel = 1,
const char*
file = NULL,
const char*
function = NULL,
int line = -1 );
73 static void debug(
const QString& var,
double val,
int debuglevel = 1,
const char*
file = NULL,
const char*
function = NULL,
int line = -1 );
77 template <
typename T>
static void debug(
const QString& var, T val,
const char*
file = 0,
const char*
function = 0,
78 int line = -1,
int debuglevel = 1 )
80 Q_UNUSED( debuglevel );
81 const char* dfile = debugFile();
84 if ( !
file || strcmp( dfile,
file ) != 0 )
89 std::ostringstream os;
90 os << var.toLocal8Bit().data() <<
" = " << val;
93 qDebug(
"%s: (%s) %s",
file + sPrefixLength,
function, os.str().c_str() );
98 qDebug(
"%s(%d): (%s) %s",
file + sPrefixLength, line,
function, os.str().c_str() );
100 qDebug(
"%s: %d: (%s) %s",
file + sPrefixLength, line,
function, os.str().c_str() );
106 static void warning(
const QString& msg );
109 static void critical(
const QString& msg );
112 static void fatal(
const QString& msg );
116 static int debugLevel();
119 static void logMessageToFile( QString theMessage );
123 static const QString logFile();
129 static const char* debugFile();
132 static int sDebugLevel;
133 static int sPrefixLength;
140 : _file( file ), _func( func ), _line( line )