diff --git a/util/auto_roll_logger.h b/util/auto_roll_logger.h index 486a1eae3..ff995f0e0 100644 --- a/util/auto_roll_logger.h +++ b/util/auto_roll_logger.h @@ -56,6 +56,12 @@ class AutoRollLogger : public Logger { return logger_->GetLogFileSize(); } + void Flush() { + if (logger_) { + logger_->Flush(); + } + } + virtual ~AutoRollLogger() { } diff --git a/util/auto_roll_logger_test.cc b/util/auto_roll_logger_test.cc index 7f75edf99..117ecd46b 100755 --- a/util/auto_roll_logger_test.cc +++ b/util/auto_roll_logger_test.cc @@ -308,6 +308,7 @@ TEST(AutoRollLoggerTest, LogHeaderTest) { Info(&logger, (kSampleMessage + ":LogHeaderTest line %d").c_str(), i); ++i; } + LogFlush(&logger); // verify that the new log contains all the header logs std::stringstream ssbuf;