5#include <source_location>
27inline auto file_name(
const char *file) ->
const char * {
28 return (strrchr(file,
'/') !=
nullptr) ? strrchr(file,
'/') + 1 : file;
32template <
typename... T>
34 fmt::format_string<T...> fmt, T &&...args) {
35 fmt::print(
"{}:{}: ",
file_name(location.file_name()), location.line());
36 fmt::print(fmt, std::forward<T>(args)...);
40template <
typename... T>
42 fmt::print(fmt, std::forward<T>(args)...);
48#define DEBUG_PRINT(str, ...) \
49 if (netlist::Config::getInstance().debugEnabled) { \
50 DebugMessage(std::source_location::current(), \
51 str __VA_OPT__(, ) __VA_ARGS__); \
54#define DEBUG_PRINT(str, ...)
57#define INFO_PRINT(str, ...) \
58 if (!Config::getInstance().quietEnabled) { \
59 InfoMessage(str __VA_OPT__(, ) __VA_ARGS__); \
bool quietEnabled
Definition Debug.hpp:14
bool debugEnabled
Definition Debug.hpp:13
void operator=(Config const &)=delete
static auto getInstance() -> Config &
Definition Debug.hpp:18
Config(Config const &)=delete
Definition Utilities.hpp:16
void InfoMessage(fmt::format_string< T... > fmt, T &&...args)
Print an informational message.
Definition Debug.hpp:41
auto file_name(const char *file) -> const char *
Definition Debug.hpp:27
void DebugMessage(const std::source_location &location, fmt::format_string< T... > fmt, T &&...args)
Print a debug message with the current file and line number.
Definition Debug.hpp:33