Skip to content

Commit 9007189

Browse files
committed
Renamed spdlog:i18n detail functions
1 parent 5850394 commit 9007189

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

src/i18n/localized_arg.ixx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ export namespace essence::i18n {
3232
template <typename T>
3333
decltype(auto) make_localized_arg(const std::locale& locale, T&& arg) {
3434
if constexpr (std::convertible_to<T, std::string_view>) {
35+
std::string_view str{std::forward<T>(arg)};
36+
3537
if (std::has_facet<simple_messages>(locale)) {
36-
return std::use_facet<simple_messages>(locale).get(std::forward<T>(arg));
38+
return std::use_facet<simple_messages>(locale).get(str);
3739
}
3840

39-
return abi::string{std::string_view{std::forward<T>(arg)}};
41+
return abi::string{str};
4042
} else {
4143
return std::forward<T>(arg);
4244
}

src/i18n/spdlog_extensions.ixx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,26 @@ namespace spdlog::i18n::detail {
3939
Args&&... args) { spdlog::error(std::forward<Args>(args)...); };
4040

4141
template <auto LogArgsFunc, typename... Args>
42-
void glog_args(
42+
void log_args(
4343
const std::locale& locale, format_string_t<essence::i18n::localized_arg_t<Args>...> fmt, Args&&... args) {
4444
LogArgsFunc(fmt, essence::i18n::make_localized_arg(locale, std::forward<Args>(args))...);
4545
}
4646

4747
template <auto LogOneFunc, typename T>
48-
void glog_one(const std::locale& locale, const T& msg) {
48+
void log_one(const std::locale& locale, const T& msg) {
4949
LogOneFunc(essence::i18n::make_localized_arg(locale, msg));
5050
}
5151
} // namespace spdlog::i18n::detail
5252

5353
export namespace spdlog::i18n {
5454
template <typename T>
5555
void info(const std::locale& locale, const T& msg) {
56-
detail::glog_one<detail::spdlog_info_func>(locale, msg);
56+
detail::log_one<detail::spdlog_info_func>(locale, msg);
5757
}
5858

5959
template <typename... Args>
6060
void info(const std::locale& locale, format_string_t<essence::i18n::localized_arg_t<Args>...> fmt, Args&&... args) {
61-
detail::glog_args<detail::spdlog_info_func>(locale, fmt, std::forward<Args>(args)...);
61+
detail::log_args<detail::spdlog_info_func>(locale, fmt, std::forward<Args>(args)...);
6262
}
6363

6464
template <typename T>
@@ -73,13 +73,13 @@ export namespace spdlog::i18n {
7373

7474
template <typename T>
7575
void trace(const std::locale& locale, const T& msg) {
76-
detail::glog_one<detail::spdlog_trace_func>(locale, msg);
76+
detail::log_one<detail::spdlog_trace_func>(locale, msg);
7777
}
7878

7979
template <typename... Args>
8080
void trace(
8181
const std::locale& locale, format_string_t<essence::i18n::localized_arg_t<Args>...> fmt, Args&&... args) {
82-
detail::glog_args<detail::spdlog_trace_func>(locale, fmt, std::forward<Args>(args)...);
82+
detail::log_args<detail::spdlog_trace_func>(locale, fmt, std::forward<Args>(args)...);
8383
}
8484

8585
template <typename T>
@@ -94,12 +94,12 @@ export namespace spdlog::i18n {
9494

9595
template <typename T>
9696
void warn(const std::locale& locale, const T& msg) {
97-
detail::glog_one<detail::spdlog_warn_func>(locale, msg);
97+
detail::log_one<detail::spdlog_warn_func>(locale, msg);
9898
}
9999

100100
template <typename... Args>
101101
void warn(const std::locale& locale, format_string_t<essence::i18n::localized_arg_t<Args>...> fmt, Args&&... args) {
102-
detail::glog_args<detail::spdlog_warn_func>(locale, fmt, std::forward<Args>(args)...);
102+
detail::log_args<detail::spdlog_warn_func>(locale, fmt, std::forward<Args>(args)...);
103103
}
104104

105105
template <typename T>
@@ -114,13 +114,13 @@ export namespace spdlog::i18n {
114114

115115
template <typename T>
116116
void error(const std::locale& locale, const T& msg) {
117-
detail::glog_one<detail::spdlog_error_func>(locale, msg);
117+
detail::log_one<detail::spdlog_error_func>(locale, msg);
118118
}
119119

120120
template <typename... Args>
121121
void error(
122122
const std::locale& locale, format_string_t<essence::i18n::localized_arg_t<Args>...> fmt, Args&&... args) {
123-
detail::glog_args<detail::spdlog_error_func>(locale, fmt, std::forward<Args>(args)...);
123+
detail::log_args<detail::spdlog_error_func>(locale, fmt, std::forward<Args>(args)...);
124124
}
125125

126126
template <typename T>

0 commit comments

Comments
 (0)