CppLogging
1.0.4.0
C++ Logging Library
|
Asynchronous wait-free logging processor. More...
#include <async_wait_free_processor.h>
Public Member Functions | |
AsyncWaitFreeProcessor (const std::shared_ptr< Layout > &layout, bool auto_start=true, size_t capacity=8192, bool discard=false, const std::function< void()> &on_thread_initialize=[](){}, const std::function< void()> &on_thread_clenup=[](){}) | |
Initialize asynchronous processor with a given layout interface, overflow policy and buffer capacity. More... | |
AsyncWaitFreeProcessor (const AsyncWaitFreeProcessor &)=delete | |
AsyncWaitFreeProcessor (AsyncWaitFreeProcessor &&)=delete | |
virtual | ~AsyncWaitFreeProcessor () |
AsyncWaitFreeProcessor & | operator= (const AsyncWaitFreeProcessor &)=delete |
AsyncWaitFreeProcessor & | operator= (AsyncWaitFreeProcessor &&)=delete |
bool | Start () override |
Start the logging processor. More... | |
bool | Stop () override |
Stop the logging processor. More... | |
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 () |
Processor & | operator= (const Processor &)=delete |
Processor & | operator= (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... | |
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 |
Asynchronous wait-free logging processor.
Asynchronous wait-free logging processor stores the given logging record into thread-safe buffer and process it in the separate thread.
This processor use fixed size async buffer which can overflow.
Please note that asynchronous logging processor moves the given logging record (ProcessRecord() method always returns false) into the buffer!
Thread-safe.
Definition at line 33 of file async_wait_free_processor.h.
|
explicit |
Initialize asynchronous processor with a given layout interface, overflow policy and buffer capacity.
layout | - Logging layout interface |
auto_start | - Auto-start the logging processor (default is true) |
capacity | - Buffer capacity in logging records (default is 8192) |
discard | - Discard logging records on buffer overflow or block and wait (default is false) |
on_thread_initialize | - Thread initialize handler can be used to initialize priority or affinity of the logging thread (default does nothing) |
on_thread_clenup | - Thread cleanup handler can be used to cleanup priority or affinity of the logging thread (default does nothing) |
Definition at line 18 of file async_wait_free_processor.cpp.
|
delete |
|
delete |
|
virtual |
Definition at line 32 of file async_wait_free_processor.cpp.
|
overridevirtual |
Flush the current logging processor.
Default behavior of the method will flush in the following sequence:
Reimplemented from CppLogging::Processor.
Definition at line 177 of file async_wait_free_processor.cpp.
|
delete |
|
delete |
|
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:
record | - Logging record |
Reimplemented from CppLogging::Processor.
Definition at line 73 of file async_wait_free_processor.cpp.
|
overridevirtual |
Start the logging processor.
Reimplemented from CppLogging::Processor.
Definition at line 39 of file async_wait_free_processor.cpp.
|
overridevirtual |
Stop the logging processor.
Reimplemented from CppLogging::Processor.
Definition at line 55 of file async_wait_free_processor.cpp.