27 #include "qgis_core.h" 28 #include "qgsconfig.h" 33 #define QgsDebugMsg(str) QgsLogger::debug(QString(str), 1, __FILE__, __FUNCTION__, __LINE__) 34 #define QgsDebugMsgLevel(str, level) QgsLogger::debug(QString(str), (level), __FILE__, __FUNCTION__, __LINE__) 35 #define QgsDebugCall QgsScopeLogger _qgsScopeLogger(__FILE__, __FUNCTION__, __LINE__) 38 #define QgsDebugMsg(str) 39 #define QgsDebugMsgLevel(str, level) 70 static void debug(
const QString &msg,
int debuglevel = 1,
const char *file =
nullptr,
const char *
function =
nullptr,
int line = -1 );
73 static void debug(
const QString &var,
int val,
int debuglevel = 1,
const char *file =
nullptr,
const char *
function =
nullptr,
int line = -1 );
79 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;
85 template <
typename T>
static void debug(
const QString &var, T val,
const char *file =
nullptr,
const char *
function =
nullptr,
86 int line = -1,
int debuglevel = 1 ) SIP_SKIP SIP_SKIP
88 std::ostringstream os;
89 os << var.toLocal8Bit().data() <<
" = " << val;
90 debug( var, os.str().c_str(), file,
function, line, debuglevel );
94 static void warning(
const QString &msg );
97 static void critical(
const QString &msg );
100 static void fatal(
const QString &msg );
108 static void logMessageToFile(
const QString &message );
113 static const QString
logFile() { init();
return sLogFile; }
119 static int sDebugLevel;
120 static int sPrefixLength;
121 static QString sLogFile;
122 static QString sFileFilter;
144 const char *_file =
nullptr;
145 const char *_func =
nullptr;
QgsLogger is a class to print debug/warning/error messages to the console.
QgsScopeLogger(const char *file, const char *func, int line)
static void debug(const QString &msg, int debuglevel=1, const char *file=nullptr, const char *function=nullptr, int line=-1)
Goes to qDebug.
static const QString logFile()
Reads the environment variable QGIS_LOG_FILE.
static int debugLevel()
Reads the environment variable QGIS_DEBUG and converts it to int.
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<<.