LogWriter.hpp
1 // @formatter:off
2 //
3 // Balau core C++ library
4 //
5 // Copyright (C) 2008 Bora Software (contact@borasoftware.com)
6 //
7 // Licensed under the Boost Software License - Version 1.0 - August 17th, 2003.
8 // See the LICENSE file for the full license text.
9 //
10 
16 
17 #ifndef COM_BORA_SOFTWARE__BALAU_TESTING__LOG_WRITER
18 #define COM_BORA_SOFTWARE__BALAU_TESTING__LOG_WRITER
19 
21 
22 namespace Balau {
23 
24 class Logger;
25 
26 namespace Testing {
27 
31 class LogWriter : public TestWriter {
32  public: explicit LogWriter(const Logger & logger_)
33  : logger(logger_) {}
34 
35  public: explicit LogWriter(const std::string & loggingNamespace = "testrunner");
36 
37  public: void writeString(const std::string & str) override;
38 
39  public: std::unique_ptr<TestWriter> clone() const override {
40  return std::unique_ptr<TestWriter>(new LogWriter(logger));
41  }
42 
44 
45  private: const Logger & logger;
46 };
47 
48 } // namespace Testing
49 
50 } // namespace Balau
51 
52 #endif // COM_BORA_SOFTWARE__BALAU_TESTING__LOG_WRITER
Base class of test writers.
Definition: TestWriter.hpp:31
The root Balau namespace.
Definition: ApplicationConfiguration.hpp:23
void writeString(const std::string &str) override
Write the supplied UTF-8 string to the writer&#39;s output stream(s).
A test writer that writes to the specified Balau logger.
Definition: LogWriter.hpp:31
The main logger class.
Definition: Logger.hpp:92
Test writer that writes to the specified Balau logger.
std::unique_ptr< TestWriter > clone() const override
Clone the writer instance.
Definition: LogWriter.hpp:39