diff options
Diffstat (limited to 'common/log.cpp')
-rw-r--r-- | common/log.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/common/log.cpp b/common/log.cpp index 0f011b1..ee28a3b 100644 --- a/common/log.cpp +++ b/common/log.cpp | |||
@@ -152,6 +152,11 @@ void Sink::Log::setAreas(const QByteArrayList &filter) | |||
152 | qputenv("SINKDEBUGAREAS", filter.join(',')); | 152 | qputenv("SINKDEBUGAREAS", filter.join(',')); |
153 | } | 153 | } |
154 | 154 | ||
155 | void Sink::Log::setDebugOutput(const QByteArrayList &output) | ||
156 | { | ||
157 | qputenv("SINKDEBUGOUTPUT", output.join(',')); | ||
158 | } | ||
159 | |||
155 | static QByteArray getProgramName() | 160 | static QByteArray getProgramName() |
156 | { | 161 | { |
157 | if (QCoreApplication::instance()) { | 162 | if (QCoreApplication::instance()) { |
@@ -171,6 +176,16 @@ static bool containsItemStartingWith(const QByteArray &pattern, const QByteArray | |||
171 | return false; | 176 | return false; |
172 | } | 177 | } |
173 | 178 | ||
179 | static bool caseInsensitiveContains(const QByteArray &pattern, const QByteArrayList &list) | ||
180 | { | ||
181 | for (const auto &item : list) { | ||
182 | if (item.toLower() == pattern) { | ||
183 | return true; | ||
184 | } | ||
185 | } | ||
186 | return false; | ||
187 | } | ||
188 | |||
174 | QDebug Sink::Log::debugStream(DebugLevel debugLevel, int line, const char* file, const char* function, const char* debugArea) | 189 | QDebug Sink::Log::debugStream(DebugLevel debugLevel, int line, const char* file, const char* function, const char* debugArea) |
175 | { | 190 | { |
176 | static NullStream nullstream; | 191 | static NullStream nullstream; |
@@ -214,9 +229,11 @@ QDebug Sink::Log::debugStream(DebugLevel debugLevel, int line, const char* file, | |||
214 | break; | 229 | break; |
215 | }; | 230 | }; |
216 | 231 | ||
217 | bool showLocation = false; | 232 | auto debugOutput = qgetenv("SINKDEBUGOUTPUT").split(','); |
218 | bool showFunction = false; | 233 | |
219 | bool showProgram = false; | 234 | bool showLocation = debugOutput.isEmpty() ? false : caseInsensitiveContains("location", debugOutput); |
235 | bool showFunction = debugOutput.isEmpty() ? false : caseInsensitiveContains("function", debugOutput); | ||
236 | bool showProgram = debugOutput.isEmpty() ? false : caseInsensitiveContains("application", debugOutput); | ||
220 | bool useColor = true; | 237 | bool useColor = true; |
221 | bool multiline = false; | 238 | bool multiline = false; |
222 | 239 | ||