CppLogging  1.0.4.0
C++ Logging Library
ostream_appender.h
Go to the documentation of this file.
1 
9 #ifndef CPPLOGGING_APPENDERS_OSTREAM_APPENDER_H
10 #define CPPLOGGING_APPENDERS_OSTREAM_APPENDER_H
11 
12 #include "logging/appender.h"
13 
14 #include <iostream>
15 
16 namespace CppLogging {
17 
19 
25 class OstreamAppender : public Appender
26 {
27 public:
29 
32  explicit OstreamAppender(std::ostream& stream) : _ostream(stream) {}
33  OstreamAppender(const OstreamAppender&) = delete;
35  virtual ~OstreamAppender() = default;
36 
39 
40  // Implementation of Appender
41  void AppendRecord(Record& record) override;
42  void Flush() override;
43 
44 private:
45  std::ostream& _ostream;
46 };
47 
48 } // namespace CppLogging
49 
50 #endif // CPPLOGGING_APPENDERS_OSTREAM_APPENDER_H
Logging appender interface definition.
Logging appender interface.
Definition: appender.h:33
Output stream (std::ostream) appender.
void AppendRecord(Record &record) override
Append the given logging record.
OstreamAppender(std::ostream &stream)
Initialize the appender with a given output stream.
OstreamAppender(OstreamAppender &&)=delete
OstreamAppender & operator=(OstreamAppender &&)=delete
virtual ~OstreamAppender()=default
OstreamAppender(const OstreamAppender &)=delete
OstreamAppender & operator=(const OstreamAppender &)=delete
void Flush() override
Flush the logging appender.
Logging record.
Definition: record.h:37
C++ Logging project definitions.
Definition: appender.h:15