提交 52e5c34a 编写于 作者: D Dengchengliang 提交者: Jiangtao Hu

Framework: add async logger stop when shutdown

上级 a4f84e68
......@@ -111,6 +111,12 @@ void CheckSingleton() {
CHECK_NOTNULL(TaskManager::Instance());
CHECK_NOTNULL(PerfEventCache::Instance());
}
void StopLogger() {
if (async_logger != nullptr) {
async_logger->Stop();
}
}
} // namespace
void OnShutdown(int sig) {
......@@ -157,6 +163,7 @@ void Shutdown() {
scheduler::Scheduler::Instance()->ShutDown();
service_discovery::TopologyManager::Instance()->Shutdown();
transport::Transport::Instance()->Shutdown();
StopLogger();
SetState(STATE_SHUTDOWN);
}
......
......@@ -71,9 +71,6 @@ void AsyncLogger::Stop() {
void AsyncLogger::Write(bool force_flush, time_t timestamp, const char* message,
int message_len) {
if (unlikely(message_len <= 0)) {
return;
}
// drop message when acitve buffer is full
if (unlikely(BufferFull(*active_buf_))) {
return;
......
......@@ -43,9 +43,6 @@ Logger::~Logger() {
void Logger::Write(bool force_flush, time_t timestamp, const char* message,
int message_len) {
if (unlikely(message_len <= 0)) {
return;
}
std::string log_message = std::string(message, message_len);
std::string module_name;
// set the same bracket as the bracket in log.h
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册