diff options
author | Ed Tanous <ed@tanous.net> | 2024-05-07 04:14:55 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2024-05-13 22:21:23 +0300 |
commit | c8491cb0b416637f1c1119c3f0d95500a4bd9c29 (patch) | |
tree | 4b03da23766397b48759caa50792f395d1a31aae | |
parent | 576db69522b81fd7702c90040e92b24368b1d3a7 (diff) | |
download | bmcweb-c8491cb0b416637f1c1119c3f0d95500a4bd9c29.tar.xz |
Move under exception handler
Static analysis still sometimes flags that this throws, even through
clang-tidy doesn't. Move it under the exception handler.
Tested: Logging still works.
Change-Id: I67425749b97b0a259746840c7b9a9b4834dfe52e
Signed-off-by: Ed Tanous <ed@tanous.net>
-rw-r--r-- | http/logging.hpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/http/logging.hpp b/http/logging.hpp index 4b9eab967c..768014a3b9 100644 --- a/http/logging.hpp +++ b/http/logging.hpp @@ -79,13 +79,14 @@ inline void vlog(std::format_string<Args...>&& format, Args&&... args, std::string_view filename = loc.file_name(); filename = filename.substr(filename.rfind('/') + 1); std::string logLocation; - logLocation = std::format("[{} {}:{}] ", levelString, filename, loc.line()); try { // TODO, multiple static analysis tools flag that this could potentially // throw Based on the documentation, it shouldn't throw, so long as none // of the formatters throw, so unclear at this point why this try/catch // is required, but add it to silence the static analysis tools. + logLocation = std::format("[{} {}:{}] ", levelString, filename, + loc.line()); logLocation += std::format(std::move(format), std::forward<Args>(args)...); } |