20 #ifndef GAIA_DEBUGGING_H 21 #define GAIA_DEBUGGING_H 24 #include <QTextStream> 25 #include <QStringList> 30 enum DebuggingModule {
42 GDescriptorTree = 1 << 11,
46 GSearchSpace = 1 << 15,
53 const char* debugModuleDescription(DebuggingModule module);
55 extern int activatedDebugLevels;
57 void setDebugLevel(
int levels);
58 void unsetDebugLevel(
int levels);
65 QStringList _msgQueue;
71 Logger() : _addHeader(
true) {}
73 void debug(DebuggingModule module,
const QString& msg,
bool resetHeader =
false);
74 void info(
const QString& msg);
75 void warning(
const QString& msg);
76 void error(
const QString& msg);
80 extern Logger loggerInstance;
91 _stream <<
'"' << var.toString() <<
'"';
101 _stream <<
"[ " << slist.join(
", ") <<
" ]";
105 template <
typename T>
107 if (list.isEmpty()) {
112 typename QList<T>::const_iterator it = list.constBegin();
113 *
this <<
"[ " << *it;
114 for (++it; it != list.constEnd(); ++it) {
115 *
this <<
", " << *it;
121 template <
typename T>
127 const QString& str()
const {
return _str; }
134 #define G_ACTIVE(module) ((module) & activatedDebugLevels) 135 #define G_STRINGIFY(msg) (gaia2::Stringifier() << msg).str() 137 #define G_HLINE "--------------------------------------------------------------------------------" 138 #define G_TITLE(str) G_STRINGIFY(QString((80-QString(str).size()-2)/2, '-') \ 139 << ' ' << str << ' ' << \ 140 QString((80-QString(str).size()-1)/2, '-')) 142 #define G_DEBUG(module, msg) if (G_ACTIVE(module)) loggerInstance.debug(module, G_STRINGIFY(msg), true) 143 #define G_INFO(msg) if (::gaia2::verbose) loggerInstance.info(G_STRINGIFY(msg)) 144 #define G_WARNING(msg) loggerInstance.warning(G_STRINGIFY(msg)) 145 #define G_ERROR(msg) loggerInstance.error(G_STRINGIFY(msg)) 147 #endif // GAIA_DEBUGGING_H Definition: debugging.h:82
Main Gaia namespace, which contains all the library functions.
Definition: addfield.cpp:22
Asynchronous thread-safe logger object.
Definition: debugging.h:63