Telegram-Android/TMessagesProj/jni/voip/tgcalls/LogSinkImpl.h
2020-12-23 11:48:30 +04:00

31 lines
647 B
C++

#ifndef TGCALLS_LOG_SINK_IMPL_H
#define TGCALLS_LOG_SINK_IMPL_H
#include "rtc_base/logging.h"
#include <fstream>
namespace tgcalls {
struct FilePath;
class LogSinkImpl final : public rtc::LogSink {
public:
LogSinkImpl(const FilePath &logPath);
void OnLogMessage(const std::string &msg, rtc::LoggingSeverity severity, const char *tag) override;
void OnLogMessage(const std::string &message, rtc::LoggingSeverity severity) override;
void OnLogMessage(const std::string &message) override;
std::string result() const {
return _data.str();
}
private:
std::ofstream _file;
std::ostringstream _data;
};
} // namespace tgcalls
#endif