Remove CircularFileStream / replace it with CallSessionFileRotatingStream.
BUG=4838, 4839
Review URL: https://codereview.webrtc.org/1245143005
Cr-Commit-Position: refs/heads/master@{#9628}
diff --git a/webrtc/base/logsinks.cc b/webrtc/base/logsinks.cc
index e202a81..4968339 100644
--- a/webrtc/base/logsinks.cc
+++ b/webrtc/base/logsinks.cc
@@ -10,8 +10,11 @@
#include "webrtc/base/logsinks.h"
+#include <iostream>
#include <string>
+#include "webrtc/base/checks.h"
+
namespace rtc {
FileRotatingLogSink::FileRotatingLogSink(const std::string& log_dir_path,
@@ -26,14 +29,15 @@
FileRotatingLogSink::FileRotatingLogSink(FileRotatingStream* stream)
: stream_(stream) {
+ DCHECK(stream);
}
FileRotatingLogSink::~FileRotatingLogSink() {
}
void FileRotatingLogSink::OnLogMessage(const std::string& message) {
- if (!stream_ || stream_->GetState() != SS_OPEN) {
- LOG(LS_WARNING) << "Init() must be called before adding this sink.";
+ if (stream_->GetState() != SS_OPEN) {
+ std::cerr << "Init() must be called before adding this sink." << std::endl;
return;
}
stream_->WriteAll(message.c_str(), message.size(), nullptr, nullptr);
@@ -43,6 +47,10 @@
return stream_->Open();
}
+bool FileRotatingLogSink::DisableBuffering() {
+ return stream_->DisableBuffering();
+}
+
CallSessionFileRotatingLogSink::CallSessionFileRotatingLogSink(
const std::string& log_dir_path,
size_t max_total_log_size)