mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-24 06:32:06 +08:00
Fixed wchar support under msvc
This commit is contained in:
parent
cdad84aa46
commit
d75fd2c7f9
@ -35,6 +35,10 @@
|
|||||||
|
|
||||||
#include <spdlog/fmt/fmt.h>
|
#include <spdlog/fmt/fmt.h>
|
||||||
|
|
||||||
|
#if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
|
||||||
|
# include <spdlog/fmt/xchar.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// visual studio upto 2013 does not support noexcept nor constexpr
|
// visual studio upto 2013 does not support noexcept nor constexpr
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1900)
|
#if defined(_MSC_VER) && (_MSC_VER < 1900)
|
||||||
# define SPDLOG_NOEXCEPT _NOEXCEPT
|
# define SPDLOG_NOEXCEPT _NOEXCEPT
|
||||||
|
20
include/spdlog/fmt/xchar.h
Normal file
20
include/spdlog/fmt/xchar.h
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
//
|
||||||
|
// Copyright(c) 2016 Gabi Melman.
|
||||||
|
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
//
|
||||||
|
// include bundled or external copy of fmtlib's ostream support
|
||||||
|
//
|
||||||
|
|
||||||
|
#if !defined(SPDLOG_FMT_EXTERNAL)
|
||||||
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
|
#ifndef FMT_HEADER_ONLY
|
||||||
|
#define FMT_HEADER_ONLY
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#include <spdlog/fmt/bundled/xchar.h>
|
||||||
|
#else
|
||||||
|
#include <fmt/xchar.h>
|
||||||
|
#endif
|
@ -50,7 +50,11 @@ struct daily_filename_format_calculator
|
|||||||
{
|
{
|
||||||
// generate fmt datetime format string, e.g. {:%Y-%m-%d}.
|
// generate fmt datetime format string, e.g. {:%Y-%m-%d}.
|
||||||
filename_t fmt_filename = fmt::format(SPDLOG_FILENAME_T("{{:{}}}"), filename);
|
filename_t fmt_filename = fmt::format(SPDLOG_FILENAME_T("{{:{}}}"), filename);
|
||||||
|
#if defined(_MSC_VER) && defined(SPDLOG_WCHAR_FILENAMES) // for some reason msvc doesnt allow fmt::runtime(..) with wchar here
|
||||||
|
return fmt::format(fmt_filename, now_tm);
|
||||||
|
#else
|
||||||
return fmt::format(fmt::runtime(fmt_filename), now_tm);
|
return fmt::format(fmt::runtime(fmt_filename), now_tm);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user