A class for subscribing to log messages which match particular patterns.
More...
|
void | enableConsoleOutput (bool enable) |
| Enable or disable the default Qt handler for messages which match the relevant pattern. More...
|
|
void | inheritConsoleOutput () |
| The policy of whether to enable or disable the default Qt handler for messages which match the relevant pattern will be inherited from the base CLogHandler, or from another CLogPatternHandler which matches a superset of the messages which this one matches. More...
|
|
|
template<typename T , typename F > |
QMetaObject::Connection | subscribe (T *receiver, F slot) |
| Convenience method to connect the messageLogged signal to a slot in the given receiver object.
|
|
template<typename F > |
QMetaObject::Connection | subscribe (F slot) |
| Convenience method to connect the messageLogged signal to a functor.
|
|
A class for subscribing to log messages which match particular patterns.
- See also
- CLogHandler::handlerForPattern
Definition at line 113 of file loghandler.h.
◆ connectNotify()
void swift::misc::CLogPatternHandler::connectNotify |
( |
const QMetaMethod & |
signal | ) |
|
|
inlineprotected |
◆ disconnectNotify()
void swift::misc::CLogPatternHandler::disconnectNotify |
( |
const QMetaMethod & |
signal | ) |
|
|
inlineprotected |
◆ enableConsoleOutput
void swift::misc::CLogPatternHandler::enableConsoleOutput |
( |
bool |
enable | ) |
|
|
inlineslot |
Enable or disable the default Qt handler for messages which match the relevant pattern.
The setting of this property in one CLogPatternHandler can override the setting in another CLogPatternHandler or the base CLogHandler, if this handler's pattern is a subset of the other handler's pattern. Which is to say, more specific patterns can override less specific patterns.
Definition at line 125 of file loghandler.h.
◆ inheritConsoleOutput
void swift::misc::CLogPatternHandler::inheritConsoleOutput |
( |
| ) |
|
|
inlineslot |
The policy of whether to enable or disable the default Qt handler for messages which match the relevant pattern will be inherited from the base CLogHandler, or from another CLogPatternHandler which matches a superset of the messages which this one matches.
This is the default, but can be used to reverse the effect of calling enableConsoleOutput.
Definition at line 140 of file loghandler.h.
◆ messageLogged
Emitted when a message is logged which matches the relevant pattern.
When all slots are disconnected from this signal, the CLogPatternHandler could be deleted.
Note that if a message matches more than one handler's pattern, then this signal will be emitted for all of those handlers, so if a slot is connected to all of them then it will be called multiple times. Use the methods CStatusMessage::markAsHandledBy() and CStatusMessage::wasHandledBy() to detect this case in the slot and avoid multiple handlings of the same message. Caveat: for this to work, the slot must take its argument by non-const reference, and be connected by Qt::DirectConnection (i.e. the receiver is in the same thread as the CLogHandler).
The documentation for this class was generated from the following file: