CppLogging  1.0.4.0
C++ Logging Library
Public Member Functions | List of all members
CppLogging::MessageFilter Class Reference

Message filter. More...

#include <message_filter.h>

Inheritance diagram for CppLogging::MessageFilter:
CppLogging::Filter CppLogging::Element

Public Member Functions

 MessageFilter (const std::regex &pattern, bool positive=true)
 Initialize message filter with a given regular expression pattern. More...
 
 MessageFilter (const MessageFilter &)=delete
 
 MessageFilter (MessageFilter &&)=delete
 
virtual ~MessageFilter ()=default
 
MessageFilteroperator= (const MessageFilter &)=delete
 
MessageFilteroperator= (MessageFilter &&)=delete
 
bool positive () const noexcept
 Get the positive filtration flag. More...
 
const std::regex & pattern () const noexcept
 Get the message regular expression pattern. More...
 
bool FilterRecord (Record &record) override
 Filter the given logging record. More...
 
- Public Member Functions inherited from CppLogging::Element
virtual bool IsStarted () const noexcept
 Is the logging element started? More...
 
virtual bool Start ()
 Start the logging element. More...
 
virtual bool Stop ()
 Stop the logging element. More...
 

Detailed Description

Message filter.

Message filters out logging records which message field is not matched to the given regular expression pattern.

Thread-safe.

Definition at line 26 of file message_filter.h.

Constructor & Destructor Documentation

◆ MessageFilter() [1/3]

CppLogging::MessageFilter::MessageFilter ( const std::regex &  pattern,
bool  positive = true 
)
inlineexplicit

Initialize message filter with a given regular expression pattern.

Parameters
pattern- Regular expression pattern
positive- Positive filtration (default is true)

Definition at line 34 of file message_filter.h.

◆ MessageFilter() [2/3]

CppLogging::MessageFilter::MessageFilter ( const MessageFilter )
delete

◆ MessageFilter() [3/3]

CppLogging::MessageFilter::MessageFilter ( MessageFilter &&  )
delete

◆ ~MessageFilter()

virtual CppLogging::MessageFilter::~MessageFilter ( )
virtualdefault

Member Function Documentation

◆ FilterRecord()

bool CppLogging::MessageFilter::FilterRecord ( Record record)
overridevirtual

Filter the given logging record.

Parameters
record- Logging record
Returns
'true' if the logging record should be processed, 'false' if the logging record was filtered out

Implements CppLogging::Filter.

Definition at line 13 of file message_filter.cpp.

◆ operator=() [1/2]

MessageFilter& CppLogging::MessageFilter::operator= ( const MessageFilter )
delete

◆ operator=() [2/2]

MessageFilter& CppLogging::MessageFilter::operator= ( MessageFilter &&  )
delete

◆ pattern()

const std::regex& CppLogging::MessageFilter::pattern ( ) const
inlinenoexcept

Get the message regular expression pattern.

Definition at line 46 of file message_filter.h.

◆ positive()

bool CppLogging::MessageFilter::positive ( ) const
inlinenoexcept

Get the positive filtration flag.

Definition at line 43 of file message_filter.h.


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