Skip to content

Commit

Permalink
🐛 fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
markparticle committed Jul 7, 2020
1 parent bd6cc94 commit 1debbc0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 7 additions & 2 deletions code/log/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,13 @@ void Log::AppendLogLevelTitle_(int level) {
}

void Log::flush(void) {
lock_guard<mutex> locker(mtx_);
fflush(fp_);
{
lock_guard<mutex> locker(mtx_);
fflush(fp_);
}
if(isAsync_) {
deque_->flush();
}
}

void Log::AsyncWrite_() {
Expand Down
1 change: 0 additions & 1 deletion code/log/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ class Log {
if (log->IsOpen() && log->GetLevel() <= level) {\
log->write(level, format, ##__VA_ARGS__); \
log->flush();\
if(isAsync_) { deque_->flush(); } \
}\
} while(0);

Expand Down

0 comments on commit 1debbc0

Please sign in to comment.