~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to python/core/qgslogger.sip

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/**QgsLogger is a class to print debug/warning/error messages to the console. The advantage of this class over std::cout, std::cerr & co. is that the output can be controlled with environment variables:
 
3
 
 
4
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
 
5
 
 
6
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
 
7
*/
 
8
 
 
9
class QgsLogger
 
10
{
 
11
%TypeHeaderCode
 
12
#include <qgslogger.h>
 
13
%End
 
14
 
 
15
 public:
 
16
 
 
17
  /**Goes to qDebug. 
 
18
  @param msg the message to be printed
 
19
  @param debuglevel 
 
20
  @param file file name where the message comes from
 
21
  @param function function where the message comes from
 
22
  @param line place in file where the message comes from*/
 
23
  static void debug(const QString& msg, int debuglevel = 1, const char* file = NULL, const char* function = NULL, int line = -1);
 
24
 
 
25
  /**Similar to the previous method, but prints a variable int-value pair*/
 
26
  static void debug(const QString& var, int val, int debuglevel = 1, const char* file = NULL, const char* function = NULL, int line = -1);
 
27
 
 
28
  /**Similar to the previous method, but prints a variable double-value pair*/
 
29
  // PyQGIS: commented out - has the same python signature as method above
 
30
  //static void debug(const QString& var, double val, int debuglevel = 1, const char* file = NULL, const char* function = NULL, int line = -1);
 
31
 
 
32
  /**Prints out a variable/value pair for types with overloaded operator<<*/
 
33
  // TODO: is it possible to make this working?
 
34
  //template <typename T> static void debug(const QString& var, T val, const char* file = 0, const char* function = 0,
 
35
  //                                                                      int line = -1, int debuglevel = 1);
 
36
 
 
37
  /**Goes to qWarning*/
 
38
  static void warning(const QString& msg); 
 
39
  
 
40
  /**Goes to qCritical*/
 
41
  static void critical(const QString& msg);
 
42
 
 
43
  /**Goes to qFatal*/
 
44
  static void fatal(const QString& msg);
 
45
 
 
46
 private:
 
47
  /**Reads the environment variable QGIS_DEBUG and converts it to int. If QGIS_DEBUG is not set,\
 
48
   the function returns 1 if QGISDEBUG is defined and 0 if not*/
 
49
  static int debugLevel();
 
50
 
 
51
  /**Reads the environment variable QGIS_DEBUG_FILE. Returns NULL if the variable is not set*/
 
52
  static const char* debugFile();
 
53
};
 
54