swift
Public Slots | Signals | Public Member Functions | Protected Member Functions | Friends | List of all members
swift::misc::CLogPatternHandler Class Reference

A class for subscribing to log messages which match particular patterns. More...

Inheritance diagram for swift::misc::CLogPatternHandler:
[legend]

Public Slots

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...
 

Signals

void messageLogged (const swift::misc::CStatusMessage &message)
 Emitted when a message is logged which matches the relevant pattern. More...
 

Public Member Functions

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.
 

Protected Member Functions

void connectNotify (const QMetaMethod &signal)
 
void disconnectNotify (const QMetaMethod &signal)
 

Friends

class CLogHandler
 

Detailed Description

A class for subscribing to log messages which match particular patterns.

See also
CLogHandler::handlerForPattern

Definition at line 113 of file loghandler.h.

Member Function Documentation

◆ connectNotify()

void swift::misc::CLogPatternHandler::connectNotify ( const QMetaMethod &  signal)
inlineprotected

Definition at line 183 of file loghandler.h.

◆ disconnectNotify()

void swift::misc::CLogPatternHandler::disconnectNotify ( const QMetaMethod &  signal)
inlineprotected

Definition at line 192 of file loghandler.h.

◆ 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

void swift::misc::CLogPatternHandler::messageLogged ( const swift::misc::CStatusMessage message)
signal

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: