|
30 | 30 | #include <sys/sendfile.h> |
31 | 31 |
|
32 | 32 | #include "instanceinfo.hpp" |
| 33 | +#include "logcat.hpp" |
33 | 34 | #include "logging_p.hpp" |
34 | 35 | #include "logging_qtprivate.cpp" // NOLINT |
35 | 36 | #include "paths.hpp" |
36 | 37 | #include "ringbuf.hpp" |
37 | 38 |
|
38 | | -Q_LOGGING_CATEGORY(logBare, "quickshell.bare"); |
| 39 | +QS_LOGGING_CATEGORY(logBare, "quickshell.bare"); |
39 | 40 |
|
40 | 41 | namespace qs::log { |
41 | 42 | using namespace qt_logging_registry; |
42 | 43 |
|
43 | | -Q_LOGGING_CATEGORY(logLogging, "quickshell.logging", QtWarningMsg); |
| 44 | +QS_LOGGING_CATEGORY(logLogging, "quickshell.logging", QtWarningMsg); |
44 | 45 |
|
45 | 46 | bool LogMessage::operator==(const LogMessage& other) const { |
46 | 47 | // note: not including time |
@@ -187,10 +188,16 @@ void LogManager::filterCategory(QLoggingCategory* category) { |
187 | 188 | // We don't respect log filters for qs logs because some distros like to ship |
188 | 189 | // default configs that hide everything. QT_LOGGING_RULES is considered via the filter list. |
189 | 190 | if (isQs) { |
190 | | - filter.debug = instance->mDefaultLevel == QtDebugMsg; |
191 | | - filter.info = instance->mDefaultLevel == QtInfoMsg; |
192 | | - filter.warn = instance->mDefaultLevel == QtWarningMsg; |
193 | | - filter.critical = instance->mDefaultLevel == QtCriticalMsg; |
| 191 | + // QtDebugMsg == 0, so default |
| 192 | + auto defaultLevel = instance->defaultLevels.value(categoryName); |
| 193 | + |
| 194 | + filter = CategoryFilter(); |
| 195 | + // clang-format off |
| 196 | + filter.debug = instance->mDefaultLevel == QtDebugMsg || defaultLevel == QtDebugMsg; |
| 197 | + filter.info = filter.debug || instance->mDefaultLevel == QtInfoMsg || defaultLevel == QtInfoMsg; |
| 198 | + filter.warn = filter.info || instance->mDefaultLevel == QtWarningMsg || defaultLevel == QtWarningMsg; |
| 199 | + filter.critical = filter.warn || instance->mDefaultLevel == QtCriticalMsg || defaultLevel == QtCriticalMsg; |
| 200 | + // clang-format on |
194 | 201 | } else if (instance->lastCategoryFilter) { |
195 | 202 | instance->lastCategoryFilter(category); |
196 | 203 | filter = CategoryFilter(category); |
@@ -262,6 +269,10 @@ void LogManager::init( |
262 | 269 | qCDebug(logLogging) << "Logger initialized."; |
263 | 270 | } |
264 | 271 |
|
| 272 | +void initLogCategoryLevel(const char* name, QtMsgType defaultLevel) { |
| 273 | + LogManager::instance()->defaultLevels.insert(QLatin1StringView(name), defaultLevel); |
| 274 | +} |
| 275 | + |
265 | 276 | void LogManager::initFs() { |
266 | 277 | QMetaObject::invokeMethod( |
267 | 278 | &LogManager::instance()->threadProxy, |
|
0 commit comments