1
0
mirror of https://github.com/gabime/spdlog.git synced 2025-05-03 05:23:51 +00:00
This commit is contained in:
gabime 2016-04-20 11:57:49 +03:00
parent 0f88996974
commit 0d26359856
39 changed files with 8951 additions and 8951 deletions

View File

@ -110,21 +110,21 @@ private:
// wchar support for windows file names (SPDLOG_WCHAR_FILENAMES must be defined) // wchar support for windows file names (SPDLOG_WCHAR_FILENAMES must be defined)
// //
#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES) #if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES)
#define SPDLOG_FILENAME_T(s) L ## s #define SPDLOG_FILENAME_T(s) L ## s
using filename_t = std::wstring; using filename_t = std::wstring;
inline std::string filename_to_str(const filename_t& filename) inline std::string filename_to_str(const filename_t& filename)
{ {
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> c; std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> c;
return c.to_bytes(filename); return c.to_bytes(filename);
} }
#else #else
#define SPDLOG_FILENAME_T(s) s #define SPDLOG_FILENAME_T(s) s
using filename_t = std::string; using filename_t = std::string;
inline std::string filename_to_str(const filename_t& filename) inline std::string filename_to_str(const filename_t& filename)
{ {
return filename; return filename;
} }
#endif #endif
} //spdlog } //spdlog

View File

@ -24,21 +24,21 @@ struct null_mutex
struct null_atomic_int struct null_atomic_int
{ {
int value; int value;
null_atomic_int() = default; null_atomic_int() = default;
null_atomic_int(int val):value(val) null_atomic_int(int val):value(val)
{} {}
int load(std::memory_order) const int load(std::memory_order) const
{ {
return value; return value;
} }
void store(int val) void store(int val)
{ {
value = val; value = val;
} }
}; };
} }

View File

@ -103,7 +103,7 @@ protected:
std::string _name; std::string _name;
std::vector<sink_ptr> _sinks; std::vector<sink_ptr> _sinks;
formatter_ptr _formatter; formatter_ptr _formatter;
spdlog::level_t _level; spdlog::level_t _level;
}; };
} }

View File

@ -201,7 +201,7 @@ private:
static filename_t calc_filename(const filename_t& basename, const filename_t& extension) static filename_t calc_filename(const filename_t& basename, const filename_t& extension)
{ {
std::tm tm = spdlog::details::os::localtime(); std::tm tm = spdlog::details::os::localtime();
std::conditional<std::is_same<filename_t::value_type, char>::value, fmt::MemoryWriter, fmt::WMemoryWriter>::type w; std::conditional<std::is_same<filename_t::value_type, char>::value, fmt::MemoryWriter, fmt::WMemoryWriter>::type w;
w.write(SPDLOG_FILENAME_T("{}_{: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(SPDLOG_FILENAME_T("{}_{: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(); return w.str();
} }