forked from quickshell/quickshell
core/log: track default logging categories
Fixes a bug in fb37be7 which ignored default logging categories due to
skipping QLoggingRegistry's filter.
This commit is contained in:
parent
5d7e07508a
commit
3d594e16dd
68 changed files with 212 additions and 79 deletions
28
src/core/logcat.hpp
Normal file
28
src/core/logcat.hpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#pragma once
|
||||
|
||||
#include <qlogging.h>
|
||||
#include <qloggingcategory.h>
|
||||
|
||||
namespace qs::log {
|
||||
void initLogCategoryLevel(const char* name, QtMsgType defaultLevel = QtDebugMsg);
|
||||
}
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
#define QS_DECLARE_LOGGING_CATEGORY(name) \
|
||||
namespace qslogcat { \
|
||||
Q_DECLARE_LOGGING_CATEGORY(name); \
|
||||
} \
|
||||
const QLoggingCategory& name()
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
#define QS_LOGGING_CATEGORY(name, category, ...) \
|
||||
namespace qslogcat { \
|
||||
Q_LOGGING_CATEGORY(name, category __VA_OPT__(, __VA_ARGS__)); \
|
||||
} \
|
||||
const QLoggingCategory& name() { \
|
||||
static auto* init = []() { \
|
||||
qs::log::initLogCategoryLevel(category __VA_OPT__(, __VA_ARGS__)); \
|
||||
return &qslogcat::name; \
|
||||
}(); \
|
||||
return (init) (); \
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue