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

Function Log

10.14-logFunction0/main.cpp:11–23  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

9
10// #A Log function taking function, line, and variadic arguments
11void Log(LogLevel level,
12 std::string_view functionName,
13 int line,
14 std::string_view fmt,
15 const auto&... args)
16{
17 std::clog << std::format("{}:{}:{}: ",
18 static_cast<unsigned int>(level),
19 functionName,
20 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