| 26 | }; |
| 27 | |
| 28 | class ConsoleSink : public LogSink |
| 29 | { |
| 30 | public: |
| 31 | ConsoleSink(const LogLevel minLevel) : LogSink(minLevel) {} |
| 32 | |
| 33 | virtual void write(const LogLevel level, const std::string &str) |
| 34 | { |
| 35 | if (level < m_minLevel) |
| 36 | return; |
| 37 | |
| 38 | // if (level == LogLevel::INFO) |
| 39 | // std::cout << "Info: "; |
| 40 | // else |
| 41 | if (level == LogLevel::WARN) |
| 42 | std::cout << "Warning: "; |
| 43 | else if (level == LogLevel::ERR) |
| 44 | std::cerr << "Error: "; |
| 45 | |
| 46 | std::cout << str << std::endl; |
| 47 | } |
| 48 | }; |
| 49 | |
| 50 | class FileSink : public LogSink |
| 51 | { |