CppLogging  1.0.4.0
C++ Logging Library
sync_processor.h
Go to the documentation of this file.
1 
9 #ifndef CPPLOGGING_PROCESSORS_SYNC_PROCESSOR_H
10 #define CPPLOGGING_PROCESSORS_SYNC_PROCESSOR_H
11 
12 #include "logging/processor.h"
13 
14 #include "threads/critical_section.h"
15 
16 namespace CppLogging {
17 
19 
26 class SyncProcessor : public Processor
27 {
28 public:
30 
33  explicit SyncProcessor(const std::shared_ptr<Layout>& layout) : Processor(layout) {}
34  SyncProcessor(const SyncProcessor&) = delete;
36  virtual ~SyncProcessor() = default;
37 
40 
41  // Implementation of Processor
42  bool ProcessRecord(Record& record) override;
43  void Flush() override;
44 
45 private:
46  CppCommon::CriticalSection _lock;
47 };
48 
49 } // namespace CppLogging
50 
53 #endif // CPPLOGGING_PROCESSORS_SYNC_PROCESSOR_H
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
Synchronous logging processor.
void Flush() override
Flush the current logging processor.
bool ProcessRecord(Record &record) override
Process the given logging record through all child filters, layouts and appenders.
SyncProcessor & operator=(const SyncProcessor &)=delete
SyncProcessor(SyncProcessor &&)=delete
SyncProcessor & operator=(SyncProcessor &&)=delete
SyncProcessor(const SyncProcessor &)=delete
virtual ~SyncProcessor()=default
SyncProcessor(const std::shared_ptr< Layout > &layout)
Initialize synchronous logging processor with a given layout interface.
C++ Logging project definitions.
Definition: appender.h:15
Logging processor interface definition.