swift
Public Member Functions | List of all members
swift::misc::CLogSubscriber Class Reference

A helper class for subscribing to log messages matching a particular pattern, with the ability to change the pattern at runtime. More...

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

Public Member Functions

 CLogSubscriber (QObject *parent=nullptr)
 Default constructor, for when you're not interested in messages and just want to control the console output.
 
template<typename T , typename F >
 CLogSubscriber (T *parent, F slot)
 Construct a subscriber which forwards messages to the given slot of parent.
 
void changeSubscription (const CLogPattern &pattern)
 Change the pattern which you want to subscribe to. More...
 
void unsubscribe ()
 Unsubscribe from all messages. 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...
 

Detailed Description

A helper class for subscribing to log messages matching a particular pattern, with the ability to change the pattern at runtime.

Also provides a thread-safe API for interacting with the CLogHandler.

Definition at line 219 of file loghandler.h.

Member Function Documentation

◆ changeSubscription()

void swift::misc::CLogSubscriber::changeSubscription ( const CLogPattern pattern)

Change the pattern which you want to subscribe to.

Remarks
This function is thread safe. If not called from the main thread, it will run asynchronously.

◆ enableConsoleOutput()

void swift::misc::CLogSubscriber::enableConsoleOutput ( bool  enable)

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.

Remarks
This function is thread safe. If not called from the main thread, it will run asynchronously.

◆ inheritConsoleOutput()

void swift::misc::CLogSubscriber::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.

This is the default, but can be used to reverse the effect of calling enableConsoleOutput.

Remarks
This function is thread safe. If not called from the main thread, it will run asynchronously.

◆ unsubscribe()

void swift::misc::CLogSubscriber::unsubscribe ( )

Unsubscribe from all messages.

Remarks
This function is thread safe. If not called from the main thread, it will run asynchronously.

The documentation for this class was generated from the following file: