5#include <source_location>
12 const char *
const cstr =
nullptr;
23template<
class... A>
void log (
const LogFormat &format,
const A &...args);
26enum LogFlags { LOG_FILE = 1, LOG_STDERR = 2, LOG_LOCATIONS = 4, };
37void logmsg (
const std::string &msg,
const char *file, uint64_t columnline,
const char *func);
39template<
class... A> __attribute__ ((__noinline__))
void
40logfmt (
const char *file, uint64_t columnline,
const char *func,
const char *format,
const A &...args)
42 logmsg (
string_format (format, args...), file, columnline, func);
45template<
class... A> __attribute__ ((__always_inline__))
inline void
46log (
const LogFormat &format,
const A &...args)
48 logfmt (format.location.file_name(),
49 uint64_t (format.location.column()) << 32 |
uint32_t (format.location.line()),
50 format.location.function_name(),
51 format.cstr, args...);
The Anklang C++ API namespace.
std::string string_format(const char *format, const Args &...args) __attribute__((__format__(__printf__
Format a string similar to sprintf(3) with support for std::string and std::ostringstream convertible...
LogFlags
Flags to configure logging behaviour.
LogFlags log_setup(int *) __attribute__((__weak__))
Configurable handler to open log files.
uint64_t timestamp_now()
Current time in µseconds.