From 2b59393bda0a5b660e64b1526837824579040d68 Mon Sep 17 00:00:00 2001 From: Artem Martynovich Date: Mon, 13 Jul 2015 19:43:22 +0600 Subject: [PATCH 1/7] Add wchar_t support for Windows. --- include/spdlog/common.h | 8 +++++ include/spdlog/details/format.h | 7 ++++- include/spdlog/details/os.h | 20 ++++++++++-- include/spdlog/details/spdlog_impl.h | 16 +++++----- include/spdlog/sinks/file_sinks.h | 47 ++++++++++++++-------------- include/spdlog/spdlog.h | 8 ++--- 6 files changed, 68 insertions(+), 38 deletions(-) diff --git a/include/spdlog/common.h b/include/spdlog/common.h index cde5a9eb..8e601547 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -36,6 +36,14 @@ #define SPDLOG_NOEXCEPT throw() #endif +#ifdef WIN32 +typedef std::wstring tstring; +typedef wchar_t tchar; +#else +#define L +typedef std::string tstring; +typedef char tchar; +#endif namespace spdlog { diff --git a/include/spdlog/details/format.h b/include/spdlog/details/format.h index 7ec3b390..f1cfd48b 100644 --- a/include/spdlog/details/format.h +++ b/include/spdlog/details/format.h @@ -2648,6 +2648,11 @@ Any write method will throw ``std::runtime_error`` if the output doesn't fit into the array. You can use one of the following typedefs for common character types: +#ifdef WIN32 +#define TMemoryWriter WMemoryWriter +#else +#define TMemoryWriter MemoryWriter +#endif +--------------+---------------------------+ | Type | Definition | @@ -3152,4 +3157,4 @@ FMT_VARIADIC(int, fprintf, std::FILE *, CStringRef) # include "format.cc" #endif -#endif // FMT_FORMAT_H_ \ No newline at end of file +#endif // FMT_FORMAT_H_ diff --git a/include/spdlog/details/os.h b/include/spdlog/details/os.h index 753b6d91..1d010937 100644 --- a/include/spdlog/details/os.h +++ b/include/spdlog/details/os.h @@ -147,17 +147,33 @@ constexpr inline unsigned short eol_size() #endif //fopen_s on non windows for writing -inline int fopen_s(FILE** fp, const std::string& filename, const char* mode) +inline int fopen_s(FILE** fp, const tstring& filename, tchar* mode) { #ifdef _WIN32 - *fp = _fsopen((filename.c_str()), mode, _SH_DENYWR); + *fp = _wfsopen((filename.c_str()), mode, _SH_DENYWR); return *fp == nullptr; #else *fp = fopen((filename.c_str()), mode); return *fp == nullptr; #endif +} +inline int remove(const tchar* filename) +{ +#ifdef _WIN32 + return _wremove(filename); +#else + return std::remove(filename); +#endif +} +inline int rename(const tchar* filename1, const tchar* filename2) +{ +#ifdef _WIN32 + return _wrename(filename1, filename2); +#else + return std::remove(filename1, filename2); +#endif } //Return utc offset in minutes or -1 on failure diff --git a/include/spdlog/details/spdlog_impl.h b/include/spdlog/details/spdlog_impl.h index cfd6f826..18cd5b65 100644 --- a/include/spdlog/details/spdlog_impl.h +++ b/include/spdlog/details/spdlog_impl.h @@ -48,24 +48,24 @@ inline void spdlog::drop(const std::string &name) } // Create multi/single threaded rotating file logger -inline std::shared_ptr spdlog::rotating_logger_mt(const std::string& logger_name, const std::string& filename, size_t max_file_size, size_t max_files, bool force_flush) +inline std::shared_ptr spdlog::rotating_logger_mt(const std::string& logger_name, const tstring& filename, size_t max_file_size, size_t max_files, bool force_flush) { - return create(logger_name, filename, "txt", max_file_size, max_files, force_flush); + return create(logger_name, filename, L"txt", max_file_size, max_files, force_flush); } -inline std::shared_ptr spdlog::rotating_logger_st(const std::string& logger_name, const std::string& filename, size_t max_file_size, size_t max_files, bool force_flush) +inline std::shared_ptr spdlog::rotating_logger_st(const std::string& logger_name, const tstring& filename, size_t max_file_size, size_t max_files, bool force_flush) { - return create(logger_name, filename, "txt", max_file_size, max_files, force_flush); + return create(logger_name, filename, L"txt", max_file_size, max_files, force_flush); } // Create file logger which creates new file at midnight): -inline std::shared_ptr spdlog::daily_logger_mt(const std::string& logger_name, const std::string& filename, int hour, int minute, bool force_flush) +inline std::shared_ptr spdlog::daily_logger_mt(const std::string& logger_name, const tstring& filename, int hour, int minute, bool force_flush) { - return create(logger_name, filename, "txt", hour, minute, force_flush); + return create(logger_name, filename, L"txt", hour, minute, force_flush); } -inline std::shared_ptr spdlog::daily_logger_st(const std::string& logger_name, const std::string& filename, int hour, int minute, bool force_flush) +inline std::shared_ptr spdlog::daily_logger_st(const std::string& logger_name, const tstring& filename, int hour, int minute, bool force_flush) { - return create(logger_name, filename, "txt", hour, minute, force_flush); + return create(logger_name, filename, L"txt", hour, minute, force_flush); } diff --git a/include/spdlog/sinks/file_sinks.h b/include/spdlog/sinks/file_sinks.h index 79cbb4e4..5f980ef3 100644 --- a/include/spdlog/sinks/file_sinks.h +++ b/include/spdlog/sinks/file_sinks.h @@ -29,6 +29,7 @@ #include "../details/null_mutex.h" #include "../details/file_helper.h" #include "../details/format.h" +#include "../details/os.h" namespace spdlog { @@ -71,7 +72,7 @@ template class rotating_file_sink : public base_sink < Mutex > { public: - rotating_file_sink(const std::string &base_filename, const std::string &extension, + rotating_file_sink(const tstring &base_filename, const tstring &extension, std::size_t max_size, std::size_t max_files, bool force_flush = false) : _base_filename(base_filename), @@ -102,13 +103,13 @@ protected: } private: - static std::string calc_filename(const std::string& filename, std::size_t index, const std::string& extension) + static tstring calc_filename(const tstring& filename, std::size_t index, const tstring& extension) { - fmt::MemoryWriter w; + fmt::TMemoryWriter w; if (index) - w.write("{}.{}.{}", filename, index, extension); + w.write(L"{}.{}.{}", filename, index, extension); else - w.write("{}.{}", filename, extension); + w.write(L"{}.{}", filename, extension); return w.str(); } @@ -123,28 +124,28 @@ private: _file_helper.close(); for (auto i = _max_files; i > 0; --i) { - std::string src = calc_filename(_base_filename, i - 1, _extension); - std::string target = calc_filename(_base_filename, i, _extension); + tstring src = calc_filename(_base_filename, i - 1, _extension); + tstring target = calc_filename(_base_filename, i, _extension); if (details::file_helper::file_exists(target)) { - if (std::remove(target.c_str()) != 0) + if (details::os::remove(target.c_str()) != 0) { - throw spdlog_ex("rotating_file_sink: failed removing " + target); + throw spdlog_ex("rotating_file_sink: failed removing"); } } - if (details::file_helper::file_exists(src) && std::rename(src.c_str(), target.c_str())) + if (details::file_helper::file_exists(src) && details::os::rename(src.c_str(), target.c_str())) { - throw spdlog_ex("rotating_file_sink: failed renaming " + src + " to " + target); + throw spdlog_ex("rotating_file_sink: failed renaming"); } } _file_helper.reopen(true); } - std::string _base_filename; - std::string _extension; - std::size_t _max_size; - std::size_t _max_files; - std::size_t _current_size; + tstring _base_filename, + _extension; + std::size_t _max_size, + _max_files, + _current_size; details::file_helper _file_helper; }; @@ -160,8 +161,8 @@ class daily_file_sink :public base_sink < Mutex > public: //create daily file sink which rotates on given time daily_file_sink( - const std::string& base_filename, - const std::string& extension, + const tstring& base_filename, + const tstring& extension, int rotation_hour, int rotation_minute, bool force_flush = false) : _base_filename(base_filename), @@ -210,16 +211,16 @@ private: } //Create filename for the form basename.YYYY-MM-DD.extension - static std::string calc_filename(const std::string& basename, const std::string& extension) + static tstring calc_filename(const tstring& basename, const tstring& extension) { std::tm tm = spdlog::details::os::localtime(); - fmt::MemoryWriter w; - w.write("{}_{:04d}-{:02d}-{:02d}_{:02d}-{:02d}.{}", basename, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, extension); + fmt::TMemoryWriter w; + w.write(L"{}_{:04d}-{:02d}-{:02d}_{:02d}-{:02d}.{}", basename, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, extension); return w.str(); } - std::string _base_filename; - std::string _extension; + tstring _base_filename; + tstring _extension; int _rotation_h; int _rotation_m; std::chrono::system_clock::time_point _rotation_tp; diff --git a/include/spdlog/spdlog.h b/include/spdlog/spdlog.h index 5cec5623..61e9a8b3 100644 --- a/include/spdlog/spdlog.h +++ b/include/spdlog/spdlog.h @@ -76,14 +76,14 @@ void set_sync_mode(); // // Create and register multi/single threaded rotating file logger // -std::shared_ptr rotating_logger_mt(const std::string& logger_name, const std::string& filename, size_t max_file_size, size_t max_files, bool force_flush = false); -std::shared_ptr rotating_logger_st(const std::string& logger_name, const std::string& filename, size_t max_file_size, size_t max_files, bool force_flush = false); +std::shared_ptr rotating_logger_mt(const std::string& logger_name, const tstring& filename, size_t max_file_size, size_t max_files, bool force_flush = false); +std::shared_ptr rotating_logger_st(const std::string& logger_name, const tstring& filename, size_t max_file_size, size_t max_files, bool force_flush = false); // // Create file logger which creates new file on the given time (default in midnight): // -std::shared_ptr daily_logger_mt(const std::string& logger_name, const std::string& filename, int hour=0, int minute=0, bool force_flush = false); -std::shared_ptr daily_logger_st(const std::string& logger_name, const std::string& filename, int hour=0, int minute=0, bool force_flush = false); +std::shared_ptr daily_logger_mt(const std::string& logger_name, const tstring& filename, int hour=0, int minute=0, bool force_flush = false); +std::shared_ptr daily_logger_st(const std::string& logger_name, const tstring& filename, int hour=0, int minute=0, bool force_flush = false); // From 0e5c4b9de458e570fa41faa717488c6c044b14ca Mon Sep 17 00:00:00 2001 From: Artem Martynovich Date: Tue, 14 Jul 2015 02:13:16 +0600 Subject: [PATCH 2/7] Fix Unix build. Use S("...") instead of L"..." for better compatibility. --- include/spdlog/common.h | 3 ++- include/spdlog/details/format.h | 11 ++++++----- include/spdlog/details/os.h | 4 ++-- include/spdlog/details/spdlog_impl.h | 8 ++++---- include/spdlog/sinks/file_sinks.h | 6 +++--- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/include/spdlog/common.h b/include/spdlog/common.h index 8e601547..d23a86bc 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -39,8 +39,9 @@ #ifdef WIN32 typedef std::wstring tstring; typedef wchar_t tchar; +#define S(s) L ## s #else -#define L +#define S(s) s typedef std::string tstring; typedef char tchar; #endif diff --git a/include/spdlog/details/format.h b/include/spdlog/details/format.h index f1cfd48b..af584b7f 100644 --- a/include/spdlog/details/format.h +++ b/include/spdlog/details/format.h @@ -2638,6 +2638,12 @@ public: typedef BasicMemoryWriter MemoryWriter; typedef BasicMemoryWriter WMemoryWriter; +#ifdef WIN32 +#define TMemoryWriter WMemoryWriter +#else +#define TMemoryWriter MemoryWriter +#endif + /** \rst This class template provides operations for formatting and writing data @@ -2648,11 +2654,6 @@ Any write method will throw ``std::runtime_error`` if the output doesn't fit into the array. You can use one of the following typedefs for common character types: -#ifdef WIN32 -#define TMemoryWriter WMemoryWriter -#else -#define TMemoryWriter MemoryWriter -#endif +--------------+---------------------------+ | Type | Definition | diff --git a/include/spdlog/details/os.h b/include/spdlog/details/os.h index 1d010937..61e05682 100644 --- a/include/spdlog/details/os.h +++ b/include/spdlog/details/os.h @@ -147,7 +147,7 @@ constexpr inline unsigned short eol_size() #endif //fopen_s on non windows for writing -inline int fopen_s(FILE** fp, const tstring& filename, tchar* mode) +inline int fopen_s(FILE** fp, const tstring& filename, const tchar* mode) { #ifdef _WIN32 *fp = _wfsopen((filename.c_str()), mode, _SH_DENYWR); @@ -172,7 +172,7 @@ inline int rename(const tchar* filename1, const tchar* filename2) #ifdef _WIN32 return _wrename(filename1, filename2); #else - return std::remove(filename1, filename2); + return std::remove(filename1); #endif } diff --git a/include/spdlog/details/spdlog_impl.h b/include/spdlog/details/spdlog_impl.h index 18cd5b65..2530b596 100644 --- a/include/spdlog/details/spdlog_impl.h +++ b/include/spdlog/details/spdlog_impl.h @@ -50,22 +50,22 @@ inline void spdlog::drop(const std::string &name) // Create multi/single threaded rotating file logger inline std::shared_ptr spdlog::rotating_logger_mt(const std::string& logger_name, const tstring& filename, size_t max_file_size, size_t max_files, bool force_flush) { - return create(logger_name, filename, L"txt", max_file_size, max_files, force_flush); + return create(logger_name, filename, S("txt"), max_file_size, max_files, force_flush); } inline std::shared_ptr spdlog::rotating_logger_st(const std::string& logger_name, const tstring& filename, size_t max_file_size, size_t max_files, bool force_flush) { - return create(logger_name, filename, L"txt", max_file_size, max_files, force_flush); + return create(logger_name, filename, S("txt"), max_file_size, max_files, force_flush); } // Create file logger which creates new file at midnight): inline std::shared_ptr spdlog::daily_logger_mt(const std::string& logger_name, const tstring& filename, int hour, int minute, bool force_flush) { - return create(logger_name, filename, L"txt", hour, minute, force_flush); + return create(logger_name, filename, S("txt"), hour, minute, force_flush); } inline std::shared_ptr spdlog::daily_logger_st(const std::string& logger_name, const tstring& filename, int hour, int minute, bool force_flush) { - return create(logger_name, filename, L"txt", hour, minute, force_flush); + return create(logger_name, filename, S("txt"), hour, minute, force_flush); } diff --git a/include/spdlog/sinks/file_sinks.h b/include/spdlog/sinks/file_sinks.h index 5f980ef3..12e36a75 100644 --- a/include/spdlog/sinks/file_sinks.h +++ b/include/spdlog/sinks/file_sinks.h @@ -107,9 +107,9 @@ private: { fmt::TMemoryWriter w; if (index) - w.write(L"{}.{}.{}", filename, index, extension); + w.write(S("{}.{}.{}"), filename, index, extension); else - w.write(L"{}.{}", filename, extension); + w.write(S("{}.{}"), filename, extension); return w.str(); } @@ -215,7 +215,7 @@ private: { std::tm tm = spdlog::details::os::localtime(); fmt::TMemoryWriter w; - w.write(L"{}_{:04d}-{:02d}-{:02d}_{:02d}-{:02d}.{}", basename, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, extension); + w.write(S("{}_{:04d}-{:02d}-{:02d}_{:02d}-{:02d}.{}"), basename, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, extension); return w.str(); } From 8b6df31ec9e64f3b42936678128c5bd0fbc2c830 Mon Sep 17 00:00:00 2001 From: Artem Martynovich Date: Tue, 14 Jul 2015 02:42:50 +0600 Subject: [PATCH 3/7] Revert to original formatting. --- include/spdlog/sinks/file_sinks.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/spdlog/sinks/file_sinks.h b/include/spdlog/sinks/file_sinks.h index 12e36a75..0f0824e7 100644 --- a/include/spdlog/sinks/file_sinks.h +++ b/include/spdlog/sinks/file_sinks.h @@ -141,11 +141,11 @@ private: } _file_helper.reopen(true); } - tstring _base_filename, - _extension; - std::size_t _max_size, - _max_files, - _current_size; + tstring _base_filename; + tstring _extension; + std::size_t _max_size; + std::size_t _max_files; + std::size_t _current_size; details::file_helper _file_helper; }; From 7ee0ec0728e3b4963b7233d8b3d58b7db74bfcaf Mon Sep 17 00:00:00 2001 From: Artem Martynovich Date: Tue, 14 Jul 2015 15:47:20 +0600 Subject: [PATCH 4/7] Fix remaining wstring issues in file_helper. --- include/spdlog/details/file_helper.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/spdlog/details/file_helper.h b/include/spdlog/details/file_helper.h index 8e1f600b..c9a70ef7 100644 --- a/include/spdlog/details/file_helper.h +++ b/include/spdlog/details/file_helper.h @@ -62,11 +62,11 @@ public: } - void open(const std::string& fname, bool truncate=false) + void open(const tstring& fname, bool truncate=false) { close(); - const char* mode = truncate ? "wb" : "ab"; + tchar* mode = truncate ? S("wb") : S("ab"); _filename = fname; for (int tries = 0; tries < open_tries; ++tries) { @@ -76,7 +76,7 @@ public: std::this_thread::sleep_for(std::chrono::milliseconds(open_interval)); } - throw spdlog_ex("Failed opening file " + fname + " for writing"); + throw spdlog_ex("Failed opening file for writing"); } void reopen(bool truncate) @@ -106,22 +106,22 @@ public: size_t size = msg.formatted.size(); auto data = msg.formatted.data(); if(std::fwrite(data, 1, size, _fd) != size) - throw spdlog_ex("Failed writing to file " + _filename); + throw spdlog_ex("Failed writing to file"); if(_force_flush) std::fflush(_fd); } - const std::string& filename() const + const tstring& filename() const { return _filename; } - static bool file_exists(const std::string& name) + static bool file_exists(const tstring& name) { FILE* file; - if (!os::fopen_s(&file, name.c_str(), "r")) + if (!os::fopen_s(&file, name.c_str(), S("r"))) { fclose(file); return true; @@ -134,7 +134,7 @@ public: private: FILE* _fd; - std::string _filename; + tstring _filename; bool _force_flush; From 5508607dfab4b8697399034f457568c9e023c58e Mon Sep 17 00:00:00 2001 From: Artem Martynovich Date: Wed, 15 Jul 2015 11:24:49 +0600 Subject: [PATCH 5/7] Fix incorrect string type for fopen_s. --- include/spdlog/details/file_helper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/spdlog/details/file_helper.h b/include/spdlog/details/file_helper.h index c9a70ef7..a5f9f265 100644 --- a/include/spdlog/details/file_helper.h +++ b/include/spdlog/details/file_helper.h @@ -66,7 +66,7 @@ public: { close(); - tchar* mode = truncate ? S("wb") : S("ab"); + const tchar* mode = truncate ? S("wb") : S("ab"); _filename = fname; for (int tries = 0; tries < open_tries; ++tries) { From 787aa4669337a51d1f24feb40a4e6478fcf857c1 Mon Sep 17 00:00:00 2001 From: Artem Martynovich Date: Tue, 21 Jul 2015 17:32:53 +0600 Subject: [PATCH 6/7] Disable usage of wchar_t in tests. --- include/spdlog/common.h | 6 +++++- include/spdlog/details/format.h | 2 +- include/spdlog/details/os.h | 12 ++++++++---- include/spdlog/tweakme.h | 6 ++++++ tests/includes.h | 1 + 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/include/spdlog/common.h b/include/spdlog/common.h index d23a86bc..dd05f1b0 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -36,7 +36,11 @@ #define SPDLOG_NOEXCEPT throw() #endif -#ifdef WIN32 +#if !defined(SPDLOG_NO_WCHAR) && defined(WIN32) +#define SPDLOG_USE_WCHAR +#endif + +#if defined(WIN32) && defined(SPDLOG_USE_WCHAR) typedef std::wstring tstring; typedef wchar_t tchar; #define S(s) L ## s diff --git a/include/spdlog/details/format.h b/include/spdlog/details/format.h index af584b7f..aaeb011d 100644 --- a/include/spdlog/details/format.h +++ b/include/spdlog/details/format.h @@ -2638,7 +2638,7 @@ public: typedef BasicMemoryWriter MemoryWriter; typedef BasicMemoryWriter WMemoryWriter; -#ifdef WIN32 +#if defined(WIN32) && defined(SPDLOG_USE_WCHAR) #define TMemoryWriter WMemoryWriter #else #define TMemoryWriter MemoryWriter diff --git a/include/spdlog/details/os.h b/include/spdlog/details/os.h index 61e05682..6af4771e 100644 --- a/include/spdlog/details/os.h +++ b/include/spdlog/details/os.h @@ -149,8 +149,12 @@ constexpr inline unsigned short eol_size() //fopen_s on non windows for writing inline int fopen_s(FILE** fp, const tstring& filename, const tchar* mode) { -#ifdef _WIN32 +#if defined(WIN32) + #if defined(SPDLOG_USE_WCHAR) *fp = _wfsopen((filename.c_str()), mode, _SH_DENYWR); + #else + *fp = _fsopen((filename.c_str()), mode, _SH_DENYWR); + #endif return *fp == nullptr; #else *fp = fopen((filename.c_str()), mode); @@ -160,7 +164,7 @@ inline int fopen_s(FILE** fp, const tstring& filename, const tchar* mode) inline int remove(const tchar* filename) { -#ifdef _WIN32 +#if defined(WIN32) && defined(SPDLOG_USE_WCHAR) return _wremove(filename); #else return std::remove(filename); @@ -169,10 +173,10 @@ inline int remove(const tchar* filename) inline int rename(const tchar* filename1, const tchar* filename2) { -#ifdef _WIN32 +#if defined(WIN32) && defined(SPDLOG_USE_WCHAR) return _wrename(filename1, filename2); #else - return std::remove(filename1); + return std::rename(filename1, filename2); #endif } diff --git a/include/spdlog/tweakme.h b/include/spdlog/tweakme.h index b651658b..5bb33afd 100644 --- a/include/spdlog/tweakme.h +++ b/include/spdlog/tweakme.h @@ -72,3 +72,9 @@ // Note that upon creating a logger the registry is modified by spdlog.. // #define SPDLOG_NO_REGISTRY_MUTEX /////////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +// Uncomment to disable usage of wchar_t for file names on Windows. +// #define SPDLOG_NO_WCHAR +/////////////////////////////////////////////////////////////////////////////// diff --git a/tests/includes.h b/tests/includes.h index 7cda161d..2c28f7d4 100644 --- a/tests/includes.h +++ b/tests/includes.h @@ -7,6 +7,7 @@ #include #include +#define SPDLOG_NO_WCHAR #include "catch.hpp" #include "../include/spdlog/spdlog.h" #include "../include/spdlog/sinks/null_sink.h" From d905ad915fe5307dba7be61169db6b8f30eb082d Mon Sep 17 00:00:00 2001 From: Ilya Kulakov Date: Sun, 26 Jul 2015 15:18:08 -0400 Subject: [PATCH 7/7] Use only SPDLOG_USE_WCHAR to control whether wchar_t is enabled. --- include/spdlog/common.h | 4 ---- include/spdlog/tweakme.h | 4 ++-- tests/includes.h | 1 - 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/include/spdlog/common.h b/include/spdlog/common.h index dd05f1b0..f86c02b9 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -36,10 +36,6 @@ #define SPDLOG_NOEXCEPT throw() #endif -#if !defined(SPDLOG_NO_WCHAR) && defined(WIN32) -#define SPDLOG_USE_WCHAR -#endif - #if defined(WIN32) && defined(SPDLOG_USE_WCHAR) typedef std::wstring tstring; typedef wchar_t tchar; diff --git a/include/spdlog/tweakme.h b/include/spdlog/tweakme.h index 5bb33afd..7e0bb41b 100644 --- a/include/spdlog/tweakme.h +++ b/include/spdlog/tweakme.h @@ -75,6 +75,6 @@ /////////////////////////////////////////////////////////////////////////////// -// Uncomment to disable usage of wchar_t for file names on Windows. -// #define SPDLOG_NO_WCHAR +// Uncomment to enable usage of wchar_t for file names on Windows. +// #define SPDLOG_USE_WCHAR /////////////////////////////////////////////////////////////////////////////// diff --git a/tests/includes.h b/tests/includes.h index 2c28f7d4..7cda161d 100644 --- a/tests/includes.h +++ b/tests/includes.h @@ -7,7 +7,6 @@ #include #include -#define SPDLOG_NO_WCHAR #include "catch.hpp" #include "../include/spdlog/spdlog.h" #include "../include/spdlog/sinks/null_sink.h"