18 #ifndef NURIA_DEBUG_HPP
19 #define NURIA_DEBUG_HPP
21 #include "essentials.hpp"
22 #include "callback.hpp"
90 class NURIA_CORE_EXPORT
Debug :
public QDebug {
101 AllLevels = CriticalMsg + 1,
102 DefaultLowestMsgLevel = DebugMsg
110 Debug (Type type,
const char *module,
const char *fileName,
int line,
111 const char *className,
const char *methodName);
129 static void setModuleLevel (
const char *module, Type leastLevel);
134 static bool isModuleDisabled (
const char *module, Type level);
138 return (level < m_lowestLevel ||
139 level < m_disabledModules.value (module, DefaultLowestMsgLevel));
151 static void qtMessageHandler (QtMsgType type,
const QMessageLogContext &context,
const QString &message);
154 static void installMessageHandler ();
163 static void setOutputDisabled (
bool disabled);
168 static bool isOutputDisabled ();
175 static void setDestination (FILE *handle);
182 static void setDestination (QIODevice *device);
209 static void installOutputHandler (
const Callback &callback);
214 static void uninstallOutputHandler (
const Callback &callback);
238 static void setOutputFormat (
const char *format);
242 void setBuffer (
const QString &buffer);
245 static Type m_lowestLevel;
246 static QMap< uint32_t, Type > m_disabledModules;
251 QLatin1String m_module;
252 QLatin1String m_file;
253 QLatin1String m_class;
254 QLatin1String m_method;
263 template<
typename T >
274 # define NURIA_MODULE ""
277 #define NURIA_DEBUG(type) \
278 if (Nuria::Debug::isModuleDisabled \
279 (Nuria::jenkinsHash (NURIA_MODULE, sizeof(NURIA_MODULE) - 1), type)) {} else \
280 Nuria::Debug(type, NURIA_MODULE, __FILE__, __LINE__, Q_FUNC_INFO, 0)
282 #ifndef NURIA_DEBUG_NO_DEBUG
283 #define nDebug() NURIA_DEBUG(Nuria::Debug::DebugMsg)
285 #define nDebug() Nuria::DebugIgnore()
288 #ifndef NURIA_DEBUG_NO_LOG
289 #define nLog() NURIA_DEBUG(Nuria::Debug::LogMsg)
291 #define nLog() Nuria::DebugIgnore()
294 #ifndef NURIA_DEBUG_NO_WARN
295 #define nWarn() NURIA_DEBUG(Nuria::Debug::WarnMsg)
297 #define nWarn() Nuria::DebugIgnore()
300 #ifndef NURIA_DEBUG_NO_ERROR
301 #define nError() NURIA_DEBUG(Nuria::Debug::ErrorMsg)
303 #define nError() Nuria::DebugIgnore()
306 #ifndef NURIA_DEBUG_NO_CRITICAL
307 #define nCritical() NURIA_DEBUG(Nuria::Debug::CriticalMsg)
309 #define nCritical() Nuria::DebugIgnore()
312 #endif // NURIA_DEBUG_HPP
A modern style callback mechanism which can be bound to various method types including slots...
Definition: callback.hpp:141
Helper class for Nuria::Debug, which does nothing.
Definition: debug.hpp:261
static bool isModuleDisabled(uint32_t module, Type level)
Definition: debug.hpp:137
Type
Definition: debug.hpp:94
Debugging and logging class of the Nuria Framework.
Definition: debug.hpp:90