Browse Source

Flush logger even if using a file.

tags/v2.0.1
Andrew Belt 2 years ago
parent
commit
1cd3b2c423
1 changed files with 2 additions and 3 deletions
  1. +2
    -3
      src/logger.cpp

+ 2
- 3
src/logger.cpp View File

@@ -107,9 +107,8 @@ static void logVa(Level level, const char* filename, int line, const char* func,
std::fprintf(outputFile, "\x1B[0m");
std::vfprintf(outputFile, format, args);
std::fprintf(outputFile, "\n");
// Don't flush log file, just console output.
if (outputFile == stderr)
std::fflush(outputFile);
// Note: This adds around 10us, but it's important for logging to finish writing the file, and logging is not used in performance critical code.
std::fflush(outputFile);
}

void log(Level level, const char* filename, int line, const char* func, const char* format, ...) {


Loading…
Cancel
Save