1
2
3
4
5
6 #include <cmajor/build/Log.hpp>
7 #include <soulng/util/CodeFormatter.hpp>
8 #include <iostream>
9
10 namespace cmajor { namespace build {
11
12 Log::~Log()
13 {
14 }
15
16 class CoutLog : public Log
17 {
18 public:
19 CoutLog();
20 void Write(const std::string& op, JsonObject* message);
21 private:
22 CodeFormatter formatter;
23 };
24
25 CoutLog::CoutLog() : formatter(std::cout)
26 {
27 formatter.SetLogging();
28 }
29
30 void CoutLog::Write(const std::string& op, JsonObject* message)
31 {
32 std::cout << op;
33 if (message)
34 {
35 message->Write(formatter);
36 }
37 }
38
39 std::std::unique_ptr<Log>CreateCoutLog()
40 {
41 return std::unique_ptr<Log>(new CoutLog());
42 }
43
44 } }