mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-16 00:45:48 +08:00
SImplify filename creation in rotating sink
This commit is contained in:
parent
554acb7429
commit
2af5eea2c6
@ -43,18 +43,14 @@ SPDLOG_INLINE rotating_file_sink<Mutex>::rotating_file_sink(
|
|||||||
template<typename Mutex>
|
template<typename Mutex>
|
||||||
SPDLOG_INLINE filename_t rotating_file_sink<Mutex>::calc_filename(const filename_t &filename, std::size_t index)
|
SPDLOG_INLINE filename_t rotating_file_sink<Mutex>::calc_filename(const filename_t &filename, std::size_t index)
|
||||||
{
|
{
|
||||||
typename std::conditional<std::is_same<filename_t::value_type, char>::value, memory_buf_t, fmt::wmemory_buffer>::type w;
|
if(index == 0u)
|
||||||
if (index != 0u)
|
{
|
||||||
{
|
return filename;
|
||||||
filename_t basename, ext;
|
}
|
||||||
std::tie(basename, ext) = details::file_helper::split_by_extension(filename);
|
|
||||||
fmt::format_to(w, SPDLOG_FILENAME_T("{}.{}{}"), basename, index, ext);
|
filename_t basename, ext;
|
||||||
}
|
std::tie(basename, ext) = details::file_helper::split_by_extension(filename);
|
||||||
else
|
return fmt::format(SPDLOG_FILENAME_T("{}.{}{}"), basename, index, ext);
|
||||||
{
|
|
||||||
fmt::format_to(w, SPDLOG_FILENAME_T("{}"), filename);
|
|
||||||
}
|
|
||||||
return fmt::to_string(w);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Mutex>
|
template<typename Mutex>
|
||||||
|
Loading…
Reference in New Issue
Block a user