32 lines
642 B
C++
32 lines
642 B
C++
#ifndef TGCALLS_LOG_SINK_IMPL_H
|
|
#define TGCALLS_LOG_SINK_IMPL_H
|
|
|
|
#include "rtc_base/logging.h"
|
|
#include <fstream>
|
|
|
|
namespace tgcalls {
|
|
|
|
struct Config;
|
|
|
|
class LogSinkImpl final : public rtc::LogSink {
|
|
public:
|
|
LogSinkImpl(const Config &config);
|
|
|
|
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
|