summaryrefslogtreecommitdiff
path: root/http
diff options
context:
space:
mode:
authorEd Tanous <ed@tanous.net>2024-04-03 20:52:39 +0300
committerEd Tanous <ed@tanous.net>2024-04-07 04:21:05 +0300
commitdce4d230c52978fc258ee3bc31117389d9c25388 (patch)
tree157c55bf271d8f8541d2b9b809dc9561b1882379 /http
parent1919a03c45725b9d52067d739a57db7cd6a201ae (diff)
downloadbmcweb-dce4d230c52978fc258ee3bc31117389d9c25388.tar.xz
Make flush explicit
A more in depth explanation of this is here[1], but being explicit flushing the buffer (using std::flush) captures intent better here, which we intend a newline, then a flush. Keeping those as separate captures the intended behavior. Tested: Launching bmcweb shows logging statements still function. [1] https://clang.llvm.org/extra/clang-tidy/checks/performance/avoid-endl.html Change-Id: I6aa427f4e4134ce30ce552cbfdd5d7be3df56c47 Signed-off-by: Ed Tanous <ed@tanous.net>
Diffstat (limited to 'http')
-rw-r--r--http/logging.hpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/http/logging.hpp b/http/logging.hpp
index 781bcfb9b2..0ed47771c4 100644
--- a/http/logging.hpp
+++ b/http/logging.hpp
@@ -196,7 +196,8 @@ inline void vlog(const FormatString& format, std::format_args&& args)
filename = filename.substr(filename.rfind('/') + 1);
std::cout << std::format("[{} {}:{}] ", levelString, filename,
format.loc.line())
- << std::vformat(format.str, args) << std::endl;
+ << std::vformat(format.str, args) << '\n'
+ << std::flush;
}
} // namespace crow