diff --git a/include/spdlog/spdlog.h b/include/spdlog/spdlog.h index 6b7b221a..cc78823a 100644 --- a/include/spdlog/spdlog.h +++ b/include/spdlog/spdlog.h @@ -19,6 +19,9 @@ #include #include #include +#if __cplusplus >= 202002L +#include +#endif namespace spdlog { @@ -164,11 +167,25 @@ inline void debug(format_string_t fmt, Args &&... args) default_logger_raw()->debug(fmt, std::forward(args)...); } +#if __cplusplus >= 202002L +template +struct info +{ + info(format_string_t fmt, Args &&...args, const std::source_location &loc = std::source_location::current()) + { + default_logger_raw()->log(spdlog::source_loc{loc.file_name(), static_cast(loc.line()), loc.function_name()}, level::info, fmt, std::forward(args)...); + } +}; + +template +info(format_string_t fmt, Args &&... args) -> info; +#else template inline void info(format_string_t fmt, Args &&... args) { default_logger_raw()->info(fmt, std::forward(args)...); } +#endif template inline void warn(format_string_t fmt, Args &&... args) @@ -262,12 +279,6 @@ inline void debug(const T &msg) default_logger_raw()->debug(msg); } -template -inline void info(const T &msg) -{ - default_logger_raw()->info(msg); -} - template inline void warn(const T &msg) {