2020-08-14 16:58:22 +00:00
|
|
|
#ifndef TGCALLS_LOG_SINK_IMPL_H
|
|
|
|
#define TGCALLS_LOG_SINK_IMPL_H
|
|
|
|
|
|
|
|
#include "rtc_base/logging.h"
|
|
|
|
#include <fstream>
|
|
|
|
|
|
|
|
namespace tgcalls {
|
|
|
|
|
2020-12-23 07:48:30 +00:00
|
|
|
struct FilePath;
|
2020-08-14 16:58:22 +00:00
|
|
|
|
|
|
|
class LogSinkImpl final : public rtc::LogSink {
|
|
|
|
public:
|
2020-12-23 07:48:30 +00:00
|
|
|
LogSinkImpl(const FilePath &logPath);
|
2020-08-14 16:58:22 +00:00
|
|
|
|
|
|
|
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
|