CppLogging 1.0.5.0
C++ Logging Library
Loading...
Searching...
No Matches
buffered_processor.h
Go to the documentation of this file.
1
9#ifndef CPPLOGGING_PROCESSORS_BUFFERED_PROCESSOR_H
10#define CPPLOGGING_PROCESSORS_BUFFERED_PROCESSOR_H
11
12#include "logging/processor.h"
13
14namespace CppLogging {
15
17
29{
30public:
32
37 explicit BufferedProcessor(const std::shared_ptr<Layout>& layout, size_t limit = 65536, size_t capacity = 8192) : Processor(layout), _limit(limit)
38 { _buffer.reserve(capacity); }
41 virtual ~BufferedProcessor() = default;
42
45
46 // Implementation of Processor
47 bool ProcessRecord(Record& record) override;
48 void Flush() override;
49
50private:
51 size_t _limit;
52 std::vector<Record> _buffer;
53
54 void ProcessBufferedRecords();
55};
56
57} // namespace CppLogging
58
59#endif // CPPLOGGING_PROCESSORS_BUFFERED_PROCESSOR_H
Buffered logging processor.
bool ProcessRecord(Record &record) override
Process the given logging record through all child filters, layouts and appenders.
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.
virtual ~BufferedProcessor()=default
BufferedProcessor(BufferedProcessor &&)=delete
BufferedProcessor & operator=(const BufferedProcessor &)=delete
void Flush() override
Flush the current logging processor.
BufferedProcessor(const BufferedProcessor &)=delete
BufferedProcessor & operator=(BufferedProcessor &&)=delete
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.