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

Buffered logging processor. More...

#include <buffered_processor.h>

Inheritance diagram for CppLogging::BufferedProcessor:
CppLogging::Processor CppLogging::Element

Public Member Functions

 BufferedProcessor (const std::shared_ptr< Layout > &layout, size_t limit=65536, size_t capacity=8192)
 Initialize buffered processor with a given layout interface, limit and capacity. More...
 
 BufferedProcessor (const BufferedProcessor &)=delete
 
 BufferedProcessor (BufferedProcessor &&)=delete
 
virtual ~BufferedProcessor ()=default
 
BufferedProcessoroperator= (const BufferedProcessor &)=delete
 
BufferedProcessoroperator= (BufferedProcessor &&)=delete
 
bool ProcessRecord (Record &record) override
 Process the given logging record through all child filters, layouts and appenders. More...
 
void Flush () override
 Flush the current logging processor. More...
 
- Public Member Functions inherited from CppLogging::Processor
 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...
 

Additional Inherited Members

- Protected Attributes inherited from CppLogging::Processor
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

Buffered logging processor.

Buffered logging processor stores all logging records in the limited size buffer until Flush() method is invoked or buffer has not enough space.

Please note that buffered logging processor moves the given logging record (ProcessRecord() method always returns false) into the buffer!

Not thread-safe.

Definition at line 28 of file buffered_processor.h.

Constructor & Destructor Documentation

◆ BufferedProcessor() [1/3]

CppLogging::BufferedProcessor::BufferedProcessor ( const std::shared_ptr< Layout > &  layout,
size_t  limit = 65536,
size_t  capacity = 8192 
)
inlineexplicit

Initialize buffered processor with a given layout interface, limit and capacity.

Parameters
layout- Logging layout interface
limit- Buffer limit in logging records (default is 65536)
capacity- Buffer initial capacity in logging records (default is 8192)

Definition at line 37 of file buffered_processor.h.

◆ BufferedProcessor() [2/3]

CppLogging::BufferedProcessor::BufferedProcessor ( const BufferedProcessor )
delete

◆ BufferedProcessor() [3/3]

CppLogging::BufferedProcessor::BufferedProcessor ( BufferedProcessor &&  )
delete

◆ ~BufferedProcessor()

virtual CppLogging::BufferedProcessor::~BufferedProcessor ( )
virtualdefault

Member Function Documentation

◆ Flush()

void CppLogging::BufferedProcessor::Flush ( )
overridevirtual

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 from CppLogging::Processor.

Definition at line 40 of file buffered_processor.cpp.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ ProcessRecord()

bool CppLogging::BufferedProcessor::ProcessRecord ( Record record)
overridevirtual

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 from CppLogging::Processor.

Definition at line 13 of file buffered_processor.cpp.


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