CppLogging  1.0.4.0
C++ Logging Library
exclusive_processor.cpp
Go to the documentation of this file.
1 
10 
11 namespace CppLogging {
12 
14 {
15  // Check if the logging processor started
16  if (!IsStarted())
17  return true;
18 
19  // Filter the given logging record
20  if (!FilterRecord(record))
21  return true;
22 
23  // Layout the given logging record
24  if (_layout && _layout->IsStarted())
25  _layout->LayoutRecord(record);
26 
27  // Append the given logging record
28  for (auto& appender : _appenders)
29  if (appender && appender->IsStarted())
30  appender->AppendRecord(record);
31 
32  // Process the given logging record with sub processors
33  for (auto& processor : _processors)
34  if (processor && processor->IsStarted() && !processor->ProcessRecord(record))
35  return false;
36 
37  // Logging record was exclusively processed!
38  return false;
39 }
40 
41 } // namespace CppLogging
bool ProcessRecord(Record &record) override
Process the given logging record through all child filters, layouts and appenders.
std::vector< std::shared_ptr< Appender > > _appenders
Definition: processor.h:101
std::shared_ptr< Layout > _layout
Definition: processor.h:99
bool IsStarted() const noexcept override
Is the logging processor started?
Definition: processor.h:55
std::vector< std::shared_ptr< Processor > > _processors
Definition: processor.h:102
virtual bool FilterRecord(Record &record)
Filter the given logging record.
Definition: processor.cpp:90
Logging record.
Definition: record.h:37
Exclusive logging processor definition.
C++ Logging project definitions.
Definition: appender.h:15