CppLogging 1.0.5.0
C++ Logging Library
Loading...
Searching...
No Matches
async_wait_free_processor.h
Go to the documentation of this file.
1
9#ifndef CPPLOGGING_PROCESSORS_ASYNC_WAIT_FREE_PROCESSOR_H
10#define CPPLOGGING_PROCESSORS_ASYNC_WAIT_FREE_PROCESSOR_H
11
12#include "logging/processor.h"
13
15
16#include <functional>
17
18namespace CppLogging {
19
21
34{
35public:
37
45 explicit 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 = [](){});
49
52
53 // Implementation of Processor
54 bool Start() override;
55 bool Stop() override;
56 bool ProcessRecord(Record& record) override;
57 void Flush() override;
58
59private:
60 bool _discard;
62 std::thread _thread;
63 std::function<void ()> _on_thread_initialize;
64 std::function<void ()> _on_thread_clenup;
65
66 bool EnqueueRecord(bool discard, Record& record);
67 void ProcessThread(const std::function<void ()>& on_thread_initialize, const std::function<void ()>& on_thread_clenup);
68};
69
70} // namespace CppLogging
71
72#endif // CPPLOGGING_PROCESSORS_ASYNC_WAIT_FREE_PROCESSOR_H
Asynchronous wait-free logging ring queue definition.
Asynchronous wait-free logging processor.
bool ProcessRecord(Record &record) override
Process the given logging record through all child filters, layouts and appenders.
AsyncWaitFreeProcessor(const AsyncWaitFreeProcessor &)=delete
AsyncWaitFreeProcessor & operator=(AsyncWaitFreeProcessor &&)=delete
void Flush() override
Flush the current logging processor.
bool Stop() override
Stop the logging element.
AsyncWaitFreeProcessor(AsyncWaitFreeProcessor &&)=delete
bool Start() override
Start the logging element.
AsyncWaitFreeProcessor & operator=(const AsyncWaitFreeProcessor &)=delete
Asynchronous wait-free logging ring queue.
Logging processor interface.
Definition processor.h:31
std::shared_ptr< Layout > & layout() noexcept
Get the logging processor layout.
Definition processor.h:46
Logging record.
Definition record.h:37
C++ Logging project definitions.
Definition appender.h:15
Logging processor interface definition.