32using namespace Qt::StringLiterals;
40#define QgsDebugError( str ) QgsLogger::debug( QString( str ), 0, __FILE__, __FUNCTION__, __LINE__ )
42#define QgsDebugMsgLevel( str, level ) \
45 if ( ( level ) <= QgsLogger::debugLevel() ) \
47 QgsLogger::debug( QString( str ), ( level ), __FILE__, __FUNCTION__, __LINE__ ); \
51#define QgsDebugErrorLoc( str, file, func, line ) QgsLogger::debug( QString( str ), 0, ( file ), ( func ), ( line ) )
53#define QgsDebugMsgLevelLoc( str, level, file, func, line ) \
56 if ( ( level ) <= QgsLogger::debugLevel() ) \
58 QgsLogger::debug( QString( str ), ( level ), ( file ), ( func ), ( line ) ); \
62#define QgsDebugCall QgsScopeLogger _qgsScopeLogger( __FILE__, __FUNCTION__, __LINE__ )
71#define QgsDebugError( str ) \
74 if constexpr ( false ) \
76 QgsLogger::debug( QString( str ), 0, "", "", 0 ); \
80#define QgsDebugMsgLevel( str, level ) \
83 if constexpr ( false ) \
85 QgsLogger::debug( QString( str ), ( level ), "", "", 0 ); \
89#define QgsDebugErrorLoc( str, file, func, line ) \
92 if constexpr ( false ) \
94 QgsLogger::debug( QString( str ), 0, ( file ), ( func ), ( line ) ); \
98#define QgsDebugMsgLevelLoc( str, level, file, func, line ) \
101 if constexpr ( false ) \
103 QgsLogger::debug( QString( str ), ( level ), ( file ), ( func ), ( line ) ); \
140 static void debug(
const QString &msg,
int debuglevel = 1,
const char *file =
nullptr,
const char *function =
nullptr,
int line = -1 );
143 static void debug(
const QString &var,
int val,
int debuglevel = 1,
const char *file =
nullptr,
const char *function =
nullptr,
int line = -1 );
149 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;
155 template<
typename T>
static void debug(
const QString &var, T val,
const char *file =
nullptr,
const char *function =
nullptr,
int line = -1,
int debuglevel = 1 )
SIP_SKIP SIP_SKIP
157 std::ostringstream os;
158 os << var.toLocal8Bit().data() <<
" = " << val;
159 debug( var, os.str().c_str(), file, function, line, debuglevel );
163 static void warning(
const QString &msg );
166 static void critical(
const QString &msg );
169 static void fatal(
const QString &msg );
177 if ( sDebugLevel == -999 )
183 static void logMessageToFile(
const QString &message );
198 static QString logFile();
204 static int sDebugLevel;
205 static int sPrefixLength;
225 const char *_file =
nullptr;
226 const char *_func =
nullptr;
Responsible for printing 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)