CppLogging
1.0.4.0
C++ Logging Library
|
Asynchronous wait logging processor. More...
#include <async_wait_processor.h>
Public Member Functions | |
AsyncWaitProcessor (const std::shared_ptr< Layout > &layout, bool auto_start=true, size_t capacity=8192, size_t initial=8192, const std::function< void()> &on_thread_initialize=[](){}, const std::function< void()> &on_thread_clenup=[](){}) | |
Initialize asynchronous processor with a given layout interface. More... | |
AsyncWaitProcessor (const AsyncWaitProcessor &)=delete | |
AsyncWaitProcessor (AsyncWaitProcessor &&)=delete | |
virtual | ~AsyncWaitProcessor () |
AsyncWaitProcessor & | operator= (const AsyncWaitProcessor &)=delete |
AsyncWaitProcessor & | operator= (AsyncWaitProcessor &&)=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 logging processor.
Asynchronous wait logging processor stores the given logging record into thread-safe buffer and process it in the separate thread.
This processor use dynamic size async buffer which cannot overflow, buy might lead to out of memory error.
Please note that asynchronous logging processor moves the given logging record (ProcessRecord() method always returns false) into the buffer!
Thread-safe.
Definition at line 35 of file async_wait_processor.h.
|
explicit |
Initialize asynchronous processor with a given layout interface.
layout | - Logging layout interface |
auto_start | - Auto-start the logging processor (default is true) |
capacity | - Buffer capacity in logging records (0 for unlimited capacity, default is 8192) |
initial | - Buffer initial capacity in logging records (default is 8192) |
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_processor.cpp.
|
delete |
|
delete |
|
virtual |
Definition at line 31 of file async_wait_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 162 of file async_wait_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 72 of file async_wait_processor.cpp.
|
overridevirtual |
Start the logging processor.
Reimplemented from CppLogging::Processor.
Definition at line 38 of file async_wait_processor.cpp.
|
overridevirtual |
Stop the logging processor.
Reimplemented from CppLogging::Processor.
Definition at line 54 of file async_wait_processor.cpp.