mirror of
https://github.com/gabime/spdlog.git
synced 2025-10-02 03:19:02 +08:00
Removed SPDLOG_WCHAR_FILENAMES support
This commit is contained in:
@@ -39,9 +39,6 @@
|
||||
|
||||
#define SPDLOG_FMT_RUNTIME(format_string) fmt::runtime(format_string)
|
||||
#define SPDLOG_FMT_STRING(format_string) FMT_STRING(format_string)
|
||||
#if defined(SPDLOG_WCHAR_FILENAMES)
|
||||
#include "fmt/xchar.h"
|
||||
#endif
|
||||
|
||||
#ifndef SPDLOG_FUNCTION
|
||||
#define SPDLOG_FUNCTION static_cast<const char *>(__FUNCTION__)
|
||||
@@ -71,15 +68,8 @@ namespace sinks {
|
||||
class sink;
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES)
|
||||
using filename_t = std::wstring;
|
||||
// allow macro expansion to occur in SPDLOG_FILENAME_T
|
||||
#define SPDLOG_FILENAME_T_INNER(s) L##s
|
||||
#define SPDLOG_FILENAME_T(s) SPDLOG_FILENAME_T_INNER(s)
|
||||
#else
|
||||
using filename_t = std::string;
|
||||
#define SPDLOG_FILENAME_T(s) s
|
||||
#endif
|
||||
#define SPDLOG_FILENAME_T(s) s
|
||||
|
||||
using log_clock = std::chrono::system_clock;
|
||||
using sink_ptr = std::shared_ptr<sinks::sink>;
|
||||
@@ -199,14 +189,6 @@ namespace details {
|
||||
|
||||
[[nodiscard]] constexpr spdlog::string_view_t to_string_view(spdlog::string_view_t str) noexcept { return str; }
|
||||
|
||||
#if defined(SPDLOG_WCHAR_FILENAMES)
|
||||
[[nodiscard]] constexpr spdlog::wstring_view_t to_string_view(const wmemory_buf_t &buf) noexcept {
|
||||
return spdlog::wstring_view_t{buf.data(), buf.size()};
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr spdlog::wstring_view_t to_string_view(spdlog::wstring_view_t str) noexcept { return str; }
|
||||
#endif
|
||||
|
||||
template <typename T, typename... Args>
|
||||
[[nodiscard]] constexpr fmt::basic_string_view<T> to_string_view(fmt::basic_format_string<T, Args...> fmt) noexcept {
|
||||
return fmt;
|
||||
|
@@ -75,12 +75,6 @@ SPDLOG_API bool is_color_terminal() noexcept;
|
||||
// Source: https://github.com/agauniyal/rang/
|
||||
SPDLOG_API bool in_terminal(FILE *file) noexcept;
|
||||
|
||||
#if defined(SPDLOG_WCHAR_FILENAMES) && defined(_WIN32)
|
||||
SPDLOG_API void wstr_to_utf8buf(wstring_view_t wstr, memory_buf_t &target);
|
||||
|
||||
SPDLOG_API void utf8_to_wstrbuf(string_view_t str, wmemory_buf_t &target);
|
||||
#endif
|
||||
|
||||
// Return directory name from given path or empty string
|
||||
// "abc/file" => "abc"
|
||||
// "abc/" => "abc"
|
||||
|
@@ -45,13 +45,9 @@ struct daily_filename_calculator {
|
||||
*/
|
||||
struct daily_filename_format_calculator {
|
||||
static filename_t calc_filename(const filename_t &file_path, const tm &now_tm) {
|
||||
#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES)
|
||||
std::wstringstream stream;
|
||||
#else
|
||||
std::stringstream stream;
|
||||
#endif
|
||||
stream << std::put_time(&now_tm, file_path.c_str());
|
||||
return stream.str();
|
||||
std::stringstream stream;
|
||||
stream << std::put_time(&now_tm, file_path.c_str());
|
||||
return stream.str();
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user