Quantum GIS API Documentation  1.7.4
Static Public Member Functions | Static Private Member Functions | Static Private Attributes
QgsLogger Class Reference

QgsLogger is a class to print debug/warning/error messages to the console. More...

#include <qgslogger.h>

List of all members.

Static Public Member Functions

static void debug (const QString &msg, int debuglevel=1, const char *file=NULL, const char *function=NULL, int line=-1)
 Goes to qDebug.
static void debug (const QString &var, int val, int debuglevel=1, const char *file=NULL, const char *function=NULL, int line=-1)
 Similar to the previous method, but prints a variable int-value pair.
static void debug (const QString &var, double val, int debuglevel=1, const char *file=NULL, const char *function=NULL, int line=-1)
 Similar to the previous method, but prints a variable double-value pair.
template<typename T >
static void debug (const QString &var, T val, const char *file=0, const char *function=0, int line=-1, int debuglevel=1)
 Prints out a variable/value pair for types with overloaded operator<<.
static void warning (const QString &msg)
 Goes to qWarning.
static void critical (const QString &msg)
 Goes to qCritical.
static void fatal (const QString &msg)
 Goes to qFatal.
static int debugLevel ()
 Reads the environment variable QGIS_DEBUG and converts it to int.

Static Private Member Functions

static const char * debugFile ()
 Reads the environment variable QGIS_DEBUG_FILE.

Static Private Attributes

static int mDebugLevel = -999
 current debug level

Detailed Description

QgsLogger is a class to print debug/warning/error messages to the console.

The advantage of this class over iostream & co. is that the output can be controlled with environment variables: QGIS_DEBUG is an int describing what debug messages are written to the console. If the debug level of a message is <= QGIS_DEBUG, the message is written to the console. It the variable QGIS_DEBUG is not defined, it defaults to 1 for debug mode and to 0 for release mode QGIS_DEBUG_FILE may contain a file name. Only the messages from this file are printed (provided they have the right debuglevel). If QGIS_DEBUG_FILE is not set, messages from all files are printed

Definition at line 50 of file qgslogger.h.


Member Function Documentation

void QgsLogger::critical ( const QString &  msg) [static]

Goes to qCritical.

Definition at line 140 of file qgslogger.cpp.

Referenced by QgsCoordinateTransform::transformCoords().

void QgsLogger::debug ( const QString &  msg,
int  debuglevel = 1,
const char *  file = NULL,
const char *  function = NULL,
int  line = -1 
) [static]

Goes to qDebug.

Parameters:
msgthe message to be printed
debuglevel
filefile name where the message comes from
functionfunction where the message comes from
lineplace in file where the message comes from

Definition at line 24 of file qgslogger.cpp.

References debugFile(), and debugLevel().

Referenced by QgsRasterDataProvider::bandStatistics(), QgsRasterLayer::hasBand(), and QgsCoordinateTransform::transform().

void QgsLogger::debug ( const QString &  var,
int  val,
int  debuglevel = 1,
const char *  file = NULL,
const char *  function = NULL,
int  line = -1 
) [static]

Similar to the previous method, but prints a variable int-value pair.

Definition at line 61 of file qgslogger.cpp.

References debugFile(), and debugLevel().

void QgsLogger::debug ( const QString &  var,
double  val,
int  debuglevel = 1,
const char *  file = NULL,
const char *  function = NULL,
int  line = -1 
) [static]

Similar to the previous method, but prints a variable double-value pair.

Definition at line 98 of file qgslogger.cpp.

References debugFile(), and debugLevel().

template<typename T >
static void QgsLogger::debug ( const QString &  var,
val,
const char *  file = 0,
const char *  function = 0,
int  line = -1,
int  debuglevel = 1 
) [inline, static]

Prints out a variable/value pair for types with overloaded operator<<.

Definition at line 69 of file qgslogger.h.

const char * QgsLogger::debugFile ( ) [static, private]

Reads the environment variable QGIS_DEBUG_FILE.

Returns NULL if the variable is not set

Definition at line 181 of file qgslogger.cpp.

Referenced by debug().

int QgsLogger::debugLevel ( ) [static]

Reads the environment variable QGIS_DEBUG and converts it to int.

If QGIS_DEBUG is not set, the function returns 1 if QGISDEBUG is defined and 0 if not

Definition at line 150 of file qgslogger.cpp.

References mDebugLevel.

Referenced by debug().

void QgsLogger::fatal ( const QString &  msg) [static]

Goes to qFatal.

Definition at line 145 of file qgslogger.cpp.

void QgsLogger::warning ( const QString &  msg) [static]

Member Data Documentation

int QgsLogger::mDebugLevel = -999 [static, private]

current debug level

Definition at line 115 of file qgslogger.h.

Referenced by debugLevel().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines