33#define QgsDebugError(str) QgsLogger::debug(QString(str), 0, __FILE__, __FUNCTION__, __LINE__)
34#define QgsDebugMsgLevel(str, level) if ( level <= QgsLogger::debugLevel() ) { QgsLogger::debug(QString(str), (level), __FILE__, __FUNCTION__, __LINE__); }(void)(0)
35#define QgsDebugErrorLoc(str, file, func, line) QgsLogger::debug(QString(str), 0, file, func, line)
36#define QgsDebugMsgLevelLoc(str, level, file, func, line) if ( level <= QgsLogger::debugLevel() ) { QgsLogger::debug(QString(str), (level), file, func, line); }(void)(0)
37#define QgsDebugCall QgsScopeLogger _qgsScopeLogger(__FILE__, __FUNCTION__, __LINE__)
39#define QgsDebugCall do {} while(false)
40#define QgsDebugError(str) do {} while(false)
41#define QgsDebugMsgLevel(str, level) do {} while(false)
42#define QgsDebugErrorLoc(str, file, func, line) do {} while(false)
43#define QgsDebugMsgLevelLoc(str, level, file, func, line) do {} while(false)
76 static void debug(
const QString &msg,
int debuglevel = 1,
const char *file =
nullptr,
const char *function =
nullptr,
int line = -1 );
79 static void debug(
const QString &var,
int val,
int debuglevel = 1,
const char *file =
nullptr,
const char *function =
nullptr,
int line = -1 );
85 static void debug(
const QString &var,
double val,
int debuglevel = 1,
const char *file =
nullptr,
const char *function =
nullptr,
int line = -1 )
SIP_SKIP SIP_SKIP;
91 template <
typename T>
static void debug(
const QString &var, T val,
const char *file =
nullptr,
const char *function =
nullptr,
94 std::ostringstream os;
95 os << var.toLocal8Bit().data() <<
" = " << val;
96 debug( var, os.str().c_str(), file, function, line, debuglevel );
100 static void warning(
const QString &msg );
103 static void critical(
const QString &msg );
106 static void fatal(
const QString &msg );
114 if ( sDebugLevel == -999 )
120 static void logMessageToFile(
const QString &message );
126 static QString logFile();
132 static int sDebugLevel;
133 static int sPrefixLength;
154 const char *_file =
nullptr;
155 const char *_func =
nullptr;
QgsLogger is a class to print debug/warning/error messages to the console.
static void debug(const QString &msg, int debuglevel=1, const char *file=nullptr, const char *function=nullptr, int line=-1)
Goes to qDebug.
static void debug(const QString &var, T val, const char *file=nullptr, const char *function=nullptr, int line=-1, int debuglevel=1)
Prints out a variable/value pair for types with overloaded operator<<.
static int debugLevel()
Reads the environment variable QGIS_DEBUG and converts it to int.
QgsScopeLogger(const char *file, const char *func, int line)