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

Logging processor interface. More...

#include <processor.h>

Inheritance diagram for CppLogging::Processor:
CppLogging::Element CppLogging::AsyncWaitFreeProcessor CppLogging::AsyncWaitProcessor CppLogging::BufferedProcessor CppLogging::ExclusiveProcessor CppLogging::SyncProcessor

Public Member Functions

 Processor (const std::shared_ptr< Layout > &layout)
 Initialize logging processor with a given layout interface. More...
 
 Processor (const Processor &)=delete
 
 Processor (Processor &&) noexcept=delete
 
virtual ~Processor ()
 
Processoroperator= (const Processor &)=delete
 
Processoroperator= (Processor &&) noexcept=delete
 
std::shared_ptr< Layout > & layout () noexcept
 Get the logging processor layout. More...
 
std::vector< std::shared_ptr< Filter > > & filters () noexcept
 Get collection of child filters. More...
 
std::vector< std::shared_ptr< Appender > > & appenders () noexcept
 Get collection of child appenders. More...
 
std::vector< std::shared_ptr< Processor > > & processors () noexcept
 Get collection of child processors. More...
 
bool IsStarted () const noexcept override
 Is the logging processor started? More...
 
bool Start () override
 Start the logging processor. More...
 
bool Stop () override
 Stop the logging processor. More...
 
virtual bool FilterRecord (Record &record)
 Filter the given logging record. More...
 
virtual bool ProcessRecord (Record &record)
 Process the given logging record through all child filters, layouts and appenders. More...
 
virtual void Flush ()
 Flush the current logging processor. More...
 

Protected Attributes

std::atomic< bool > _started {true}
 
std::shared_ptr< Layout_layout
 
std::vector< std::shared_ptr< Filter > > _filters
 
std::vector< std::shared_ptr< Appender > > _appenders
 
std::vector< std::shared_ptr< Processor > > _processors
 

Detailed Description

Logging processor interface.

Logging processor takes an instance of a single logging record and process it though all child filters, layouts and appenders.

Not thread-safe.

See also
SyncProcessor
AsyncProcessor
BufferedProcessor
ExclusiveProcessor

Definition at line 30 of file processor.h.

Constructor & Destructor Documentation

◆ Processor() [1/3]

CppLogging::Processor::Processor ( const std::shared_ptr< Layout > &  layout)
inlineexplicit

Initialize logging processor with a given layout interface.

Parameters
layout- Logging layout interface

Definition at line 37 of file processor.h.

◆ Processor() [2/3]

CppLogging::Processor::Processor ( const Processor )
delete

◆ Processor() [3/3]

CppLogging::Processor::Processor ( Processor &&  )
deletenoexcept

◆ ~Processor()

CppLogging::Processor::~Processor ( )
virtual

Definition at line 13 of file processor.cpp.

Member Function Documentation

◆ appenders()

std::vector<std::shared_ptr<Appender> >& CppLogging::Processor::appenders ( )
inlinenoexcept

Get collection of child appenders.

Definition at line 50 of file processor.h.

◆ FilterRecord()

bool CppLogging::Processor::FilterRecord ( Record record)
virtual

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

Definition at line 90 of file processor.cpp.

◆ filters()

std::vector<std::shared_ptr<Filter> >& CppLogging::Processor::filters ( )
inlinenoexcept

Get collection of child filters.

Definition at line 48 of file processor.h.

◆ Flush()

void CppLogging::Processor::Flush ( )
virtual

Flush the current logging processor.

Default behavior of the method will flush in the following sequence:

  • all appenders (if any present)
  • all sub processors (if any present)

Reimplemented in CppLogging::SyncProcessor, CppLogging::BufferedProcessor, CppLogging::AsyncWaitProcessor, and CppLogging::AsyncWaitFreeProcessor.

Definition at line 127 of file processor.cpp.

◆ IsStarted()

bool CppLogging::Processor::IsStarted ( ) const
inlineoverridevirtualnoexcept

Is the logging processor started?

Reimplemented from CppLogging::Element.

Definition at line 55 of file processor.h.

◆ layout()

std::shared_ptr<Layout>& CppLogging::Processor::layout ( )
inlinenoexcept

Get the logging processor layout.

Definition at line 46 of file processor.h.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

Processor& CppLogging::Processor::operator= ( Processor &&  )
deletenoexcept

◆ processors()

std::vector<std::shared_ptr<Processor> >& CppLogging::Processor::processors ( )
inlinenoexcept

Get collection of child processors.

Definition at line 52 of file processor.h.

◆ ProcessRecord()

bool CppLogging::Processor::ProcessRecord ( Record record)
virtual

Process the given logging record through all child filters, layouts and appenders.

Default behavior of the method will take the given logging record and process it in the following sequence:

  • all filters (if any present)
  • all layouts (if any present)
  • all appenders (if any present)
  • all sub processors (if any present)
Parameters
record- Logging record
Returns
'true' if the logging record was successfully processed, 'false' if the logging record was filtered out

Reimplemented in CppLogging::SyncProcessor, CppLogging::ExclusiveProcessor, CppLogging::BufferedProcessor, CppLogging::AsyncWaitProcessor, and CppLogging::AsyncWaitFreeProcessor.

Definition at line 100 of file processor.cpp.

◆ Start()

bool CppLogging::Processor::Start ( )
overridevirtual

Start the logging processor.

Returns
'true' if the logging processor was successfully started, 'false' if the logging processor failed to start

Reimplemented from CppLogging::Element.

Reimplemented in CppLogging::AsyncWaitProcessor, and CppLogging::AsyncWaitFreeProcessor.

Definition at line 30 of file processor.cpp.

◆ Stop()

bool CppLogging::Processor::Stop ( )
overridevirtual

Stop the logging processor.

Returns
'true' if the logging processor was successfully stopped, 'false' if the logging processor failed to stop

Reimplemented from CppLogging::Element.

Reimplemented in CppLogging::AsyncWaitProcessor, and CppLogging::AsyncWaitFreeProcessor.

Definition at line 60 of file processor.cpp.

Member Data Documentation

◆ _appenders

std::vector<std::shared_ptr<Appender> > CppLogging::Processor::_appenders
protected

Definition at line 101 of file processor.h.

◆ _filters

std::vector<std::shared_ptr<Filter> > CppLogging::Processor::_filters
protected

Definition at line 100 of file processor.h.

◆ _layout

std::shared_ptr<Layout> CppLogging::Processor::_layout
protected

Definition at line 99 of file processor.h.

◆ _processors

std::vector<std::shared_ptr<Processor> > CppLogging::Processor::_processors
protected

Definition at line 102 of file processor.h.

◆ _started

std::atomic<bool> CppLogging::Processor::_started {true}
protected

Definition at line 98 of file processor.h.


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