Skip to content

Commit c8491cb

Browse files
committed
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>
1 parent 576db69 commit c8491cb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

http/logging.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,14 @@ inline void vlog(std::format_string<Args...>&& format, Args&&... args,
7979
std::string_view filename = loc.file_name();
8080
filename = filename.substr(filename.rfind('/') + 1);
8181
std::string logLocation;
82-
logLocation = std::format("[{} {}:{}] ", levelString, filename, loc.line());
8382
try
8483
{
8584
// TODO, multiple static analysis tools flag that this could potentially
8685
// throw Based on the documentation, it shouldn't throw, so long as none
8786
// of the formatters throw, so unclear at this point why this try/catch
8887
// is required, but add it to silence the static analysis tools.
88+
logLocation = std::format("[{} {}:{}] ", levelString, filename,
89+
loc.line());
8990
logLocation += std::format(std::move(format),
9091
std::forward<Args>(args)...);
9192
}

0 commit comments

Comments
 (0)