25#include "globalization/globalized_arg.hpp"
29#include <spdlog/spdlog.h>
31namespace spdlog::detail {
32 inline constexpr auto spdlog_info_func = []<
typename... Args>(
33 Args&&... args) { spdlog::info(std::forward<Args>(args)...); };
35 inline constexpr auto spdlog_trace_func = []<
typename... Args>(
36 Args&&... args) { spdlog::trace(std::forward<Args>(args)...); };
38 inline constexpr auto spdlog_warn_func = []<
typename... Args>(
39 Args&&... args) { spdlog::warn(std::forward<Args>(args)...); };
41 inline constexpr auto spdlog_error_func = []<
typename... Args>(
42 Args&&... args) { spdlog::error(std::forward<Args>(args)...); };
44 template <
auto LogArgsFunc,
typename... Args>
45 void glog_args(
const std::locale& locale, format_string_t<essence::globalization::globalized_arg_t<Args>...> fmt,
47 LogArgsFunc(fmt, essence::globalization::make_globalized_arg(locale, std::forward<Args>(args))...);
50 template <auto LogOneFunc,
typename T>
51 void glog_one(
const std::locale& locale,
const T& msg) {
52 LogOneFunc(essence::globalization::make_globalized_arg(locale, msg));
57 template <
typename... Args>
58 void ginfo(
const std::locale& locale, format_string_t<essence::globalization::globalized_arg_t<Args>...> fmt,
60 detail::glog_args<detail::spdlog_info_func>(locale, fmt, std::forward<Args>(args)...);
64 void ginfo(
const std::locale& locale,
const T& msg) {
65 detail::glog_one<detail::spdlog_info_func>(locale, msg);
68 template <
typename... Args>
69 void gtrace(
const std::locale& locale, format_string_t<essence::globalization::globalized_arg_t<Args>...> fmt,
71 detail::glog_args<detail::spdlog_trace_func>(locale, fmt, std::forward<Args>(args)...);
75 void gtrace(
const std::locale& locale,
const T& msg) {
76 detail::glog_one<detail::spdlog_trace_func>(locale, msg);
79 template <
typename... Args>
80 void gwarn(
const std::locale& locale, format_string_t<essence::globalization::globalized_arg_t<Args>...> fmt,
82 detail::glog_args<detail::spdlog_warn_func>(locale, fmt, std::forward<Args>(args)...);
86 void gwarn(
const std::locale& locale,
const T& msg) {
87 detail::glog_one<detail::spdlog_warn_func>(locale, msg);
90 template <
typename... Args>
91 void gerror(
const std::locale& locale, format_string_t<essence::globalization::globalized_arg_t<Args>...> fmt,
93 detail::glog_args<detail::spdlog_error_func>(locale, fmt, std::forward<Args>(args)...);
97 void gerror(
const std::locale& locale,
const T& msg) {
98 detail::glog_one<detail::spdlog_error_func>(locale, msg);