diff --git a/include/spdlog/details/os-inl.h b/include/spdlog/details/os-inl.h index fc4a4369..1126da4f 100644 --- a/include/spdlog/details/os-inl.h +++ b/include/spdlog/details/os-inl.h @@ -262,7 +262,7 @@ SPDLOG_INLINE int utc_minutes_offset(const std::tm &tm) auto rv = ::GetDynamicTimeZoneInformation(&tzinfo); #endif if (rv == TIME_ZONE_ID_INVALID) - SPDLOG_THROW(spdlog::spdlog_ex("Failed getting timezone info. ", errno)); + throw_spdlog_ex("Failed getting timezone info. ", errno); int offset = -tzinfo.Bias; if (tm.tm_isdst) @@ -429,7 +429,7 @@ SPDLOG_INLINE void wstr_to_utf8buf(wstring_view_t wstr, memory_buf_t &target) { if (wstr.size() > static_cast((std::numeric_limits::max)())) { - SPDLOG_THROW(spdlog::spdlog_ex("UTF-16 string is too big to be converted to UTF-8")); + throw_spdlog_ex("UTF-16 string is too big to be converted to UTF-8"); } int wstr_size = static_cast(wstr.size()); @@ -457,7 +457,7 @@ SPDLOG_INLINE void wstr_to_utf8buf(wstring_view_t wstr, memory_buf_t &target) } } - SPDLOG_THROW(spdlog::spdlog_ex(fmt::format("WideCharToMultiByte failed. Last error: {}", ::GetLastError()))); + throw_spdlog_ex(fmt::format("WideCharToMultiByte failed. Last error: {}", ::GetLastError())); } #endif // (defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) || defined(SPDLOG_WCHAR_FILENAMES)) && defined(_WIN32) diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index e2035a09..8d331b0d 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -68,7 +68,7 @@ public: if (rv != 0) { auto msg = fmt::format("::getaddrinfo failed: {}", gai_strerror(rv)); - SPDLOG_THROW(spdlog::spdlog_ex(msg)); + throw_spdlog_ex(msg); } // Try each address until we successfully connect(2). @@ -97,7 +97,7 @@ public: ::freeaddrinfo(addrinfo_result); if (socket_ == -1) { - SPDLOG_THROW(spdlog::spdlog_ex("::connect failed", last_errno)); + throw_spdlog_ex("::connect failed", last_errno); } // set TCP_NODELAY @@ -130,7 +130,7 @@ public: if (write_result < 0) { close(); - SPDLOG_THROW(spdlog::spdlog_ex("write(2) failed", errno)); + throw_spdlog_ex("write(2) failed", errno); } if (write_result == 0) // (probably should not happen but in any case..) diff --git a/include/spdlog/sinks/rotating_file_sink-inl.h b/include/spdlog/sinks/rotating_file_sink-inl.h index c30450ee..d715ebf3 100644 --- a/include/spdlog/sinks/rotating_file_sink-inl.h +++ b/include/spdlog/sinks/rotating_file_sink-inl.h @@ -110,8 +110,7 @@ SPDLOG_INLINE void rotating_file_sink::rotate_() { file_helper_.reopen(true); // truncate the log file anyway to prevent it to grow beyond its limit! current_size_ = 0; - SPDLOG_THROW( - spdlog_ex("rotating_file_sink: failed renaming " + filename_to_str(src) + " to " + filename_to_str(target), errno)); + throw_spdlog_ex("rotating_file_sink: failed renaming " + filename_to_str(src) + " to " + filename_to_str(target), errno); } } } diff --git a/include/spdlog/sinks/win_eventlog_sink.h b/include/spdlog/sinks/win_eventlog_sink.h index a0a14841..9610126a 100644 --- a/include/spdlog/sinks/win_eventlog_sink.h +++ b/include/spdlog/sinks/win_eventlog_sink.h @@ -176,7 +176,7 @@ struct eventlog default: // should be unreachable - SPDLOG_THROW(std::logic_error(fmt::format("Unsupported log level {}", msg.level))); + throw_spdlog_ex(fmt::format("Unsupported log level {}", msg.level)); } }