summaryrefslogtreecommitdiffstats
path: root/common/log.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/log.h')
-rw-r--r--common/log.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/common/log.h b/common/log.h
index f47a3ae..9063ac8 100644
--- a/common/log.h
+++ b/common/log.h
@@ -6,6 +6,14 @@
6namespace Sink { 6namespace Sink {
7namespace Log { 7namespace Log {
8 8
9struct Context {
10 Context() = default;
11 QByteArray name;
12 Context subContext(const QByteArray &sub) const {
13 return Context{name + "." + sub};
14 }
15};
16
9enum DebugLevel 17enum DebugLevel
10{ 18{
11 Trace, 19 Trace,
@@ -91,6 +99,11 @@ static const char *getComponentName() { return nullptr; }
91#define SinkWarning() Sink::Log::debugStream(Sink::Log::DebugLevel::Warning, __LINE__, __FILE__, Q_FUNC_INFO, s_sinkDebugArea, getComponentName()) 99#define SinkWarning() Sink::Log::debugStream(Sink::Log::DebugLevel::Warning, __LINE__, __FILE__, Q_FUNC_INFO, s_sinkDebugArea, getComponentName())
92#define SinkError() Sink::Log::debugStream(Sink::Log::DebugLevel::Error, __LINE__, __FILE__, Q_FUNC_INFO, s_sinkDebugArea, getComponentName()) 100#define SinkError() Sink::Log::debugStream(Sink::Log::DebugLevel::Error, __LINE__, __FILE__, Q_FUNC_INFO, s_sinkDebugArea, getComponentName())
93 101
102#define SinkTraceCtx(CTX) Sink::Log::debugStream(Sink::Log::DebugLevel::Trace, __LINE__, __FILE__, Q_FUNC_INFO, CTX.name, getComponentName())
103#define SinkLogCtx(CTX) Sink::Log::debugStream(Sink::Log::DebugLevel::Log, __LINE__, __FILE__, Q_FUNC_INFO, CTX.name, getComponentName())
104#define SinkWarningCtx(CTX) Sink::Log::debugStream(Sink::Log::DebugLevel::Warning, __LINE__, __FILE__, Q_FUNC_INFO, CTX.name, getComponentName())
105#define SinkErrorCtx(CTX) Sink::Log::debugStream(Sink::Log::DebugLevel::Error, __LINE__, __FILE__, Q_FUNC_INFO, CTX.name, getComponentName())
106
94#define SINK_DEBUG_AREA(AREA) static constexpr const char* s_sinkDebugArea{AREA}; 107#define SINK_DEBUG_AREA(AREA) static constexpr const char* s_sinkDebugArea{AREA};
95#define SINK_DEBUG_COMPONENT(COMPONENT) const char* getComponentName() const { return COMPONENT; }; 108#define SINK_DEBUG_COMPONENT(COMPONENT) const char* getComponentName() const { return COMPONENT; };
96#define SINK_DEBUG_COMPONENT_STATIC(COMPONENT) static const char* getComponentName() { return COMPONENT; }; 109#define SINK_DEBUG_COMPONENT_STATIC(COMPONENT) static const char* getComponentName() { return COMPONENT; };