| #include <fstream> |
| 6 |
| 7 | namespace tgcalls { |
| 8 |
| 9 | struct FilePath; |
| 10 |
| 11 | class LogSinkImpl final : public rtc::LogSink { |
| 12 | public: |
| 13 | LogSinkImpl(const FilePath &logPath); |
| 14 |
| 15 | void OnLogMessage(const std::string &msg, rtc::LoggingSeverity severity, const char *tag) override; |
| 16 | void OnLogMessage(const std::string &message, rtc::LoggingSeverity severity) override; |
| 17 | void OnLogMessage(const std::string &message) override; |
| 18 |
| 19 | std::string result() const { |
| 20 | return _data.str(); |
| 21 | } |
| 22 |
| 23 | private: |
| 24 | std::ofstream _file; |
| 25 | std::ostringstream _data; |
| 26 |
| 27 | }; |
| 28 |
| 29 | } // namespace tgcalls |
| 30 |
| 31 | #endif |
| 32 |