reportdebug.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef REPORTDEBUG_H
00020 #define REPORTDEBUG_H
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 namespace reports {
00032
00033
00034 #undef DEBUG_REPORTS
00035
00036
00037 #define DEBUG_ENABLED_BY_DEFAULT false
00038
00039 #ifdef DEBUG_REPORTS
00040
00041
00042
00043
00044 #undef DEBUG_HIDE_SENSITIVE
00045
00046 #define DEBUG_ENTER(x) Debug ___DEBUG(x)
00047 #define DEBUG_OUTPUT(x) ___DEBUG.output(x)
00048 #define DEBUG_OUTPUT_IF(x,y) { if (x) ___DEBUG.output(y); }
00049 #define DEBUG_ENABLE(x) Debug::enable(x)
00050 #define DEBUG_ENABLE_KEY(x) Debug::setEnableKey(x)
00051 #ifdef DEBUG_HIDE_SENSITIVE
00052 #define DEBUG_SENSITIVE(x) QString("hidden")
00053 #else
00054 #define DEBUG_SENSITIVE(x) (x)
00055 #endif
00056
00057 #else
00058
00059 #define DEBUG_ENTER(x)
00060 #define DEBUG_OUTPUT(x)
00061 #define DEBUG_OUTPUT_IF(x,y)
00062 #define DEBUG_ENABLE(x)
00063 #define DEBUG_SENSITIVE(x)
00064 #endif
00065
00066 class Debug
00067 {
00068 QString m_methodName;
00069 static QString m_sTabs;
00070 static bool m_sEnabled;
00071 bool m_enabled;
00072 static QString m_sEnableKey;
00073 public:
00074 Debug( const QString& _name );
00075 ~Debug();
00076 void output( const QString& _text );
00077 static void enable( bool _e ) { m_sEnabled = _e; }
00078 static void setEnableKey( const QString& _s ) { m_sEnableKey = _s; }
00079 };
00080
00081 }
00082
00083 #endif // REPORTDEBUG_H