MCPcopy Create free account
hub / github.com/andreasfertig/programming-with-cpp20 / Log

Function Log

10.15-logFunction1/main.cpp:12–23  ·  view source on GitHub ↗

#A Log function taking function, line, and variadic arguments

Source from the content-addressed store, hash-verified

10
11// #A Log function taking function, line, and variadic arguments
12void Log(LogLevel level,
13 std::source_location location,
14 std::string_view fmt,
15 const auto&... args)
16{
17 std::clog << std::format("{}:{}:{}: ",
18 static_cast<unsigned int>(level),
19 location.function_name(),
20 location.line())
21 << std::vformat(fmt, std::make_format_args(args...))
22 << '\n';
23}
24
25// #B Macro wrapper to call Log
26#define LOG(level, fmt, ...) \

Callers

nothing calls this directly

Calls 1

formatFunction · 0.50

Tested by

no test coverage detected