14 namespace fmt_helper {
16 template<
size_t Buffer_Size>
22 template<
size_t Buffer_Size1,
size_t Buffer_Size2>
23 inline void append_buf(
const fmt::basic_memory_buffer<char, Buffer_Size1> &buf, fmt::basic_memory_buffer<char, Buffer_Size2> &
dest)
25 auto *buf_ptr = buf.data();
26 dest.append(buf_ptr, buf_ptr + buf.size());
29 template<
size_t Buffer_Size>
32 auto *buf_ptr = view.data();
33 if (buf_ptr !=
nullptr)
35 dest.append(buf_ptr, buf_ptr + view.size());
39 template<
typename T,
size_t Buffer_Size>
43 dest.append(i.data(), i.data() + i.size());
53 template<
size_t Buffer_Size>
54 inline void pad2(
int n, fmt::basic_memory_buffer<char, Buffer_Size> &
dest)
62 dest.push_back(static_cast<char>(
'0' + n / 10));
63 dest.push_back(static_cast<char>(
'0' + n % 10));
68 dest.push_back(static_cast<char>(
'0' + n));
76 template<
typename T,
size_t Buffer_Size>
83 const char *zeroes =
"0000000000000000000";
84 dest.append(zeroes, zeroes + width - digits);
89 template<
typename T,
size_t Buffer_Size>
90 inline void pad3(
T n, fmt::basic_memory_buffer<char, Buffer_Size> &
dest)
95 template<
typename T,
size_t Buffer_Size>
96 inline void pad6(
T n, fmt::basic_memory_buffer<char, Buffer_Size> &
dest)
101 template<
typename T,
size_t Buffer_Size>
102 inline void pad9(
T n, fmt::basic_memory_buffer<char, Buffer_Size> &
dest)
110 template<
typename ToDuration>
113 using std::chrono::duration_cast;
115 auto duration = tp.time_since_epoch();
116 auto secs = duration_cast<
seconds>(duration);
117 return duration_cast<ToDuration>(duration) - duration_cast<ToDuration>(secs);
void append_int(T n, fmt::basic_memory_buffer< char, Buffer_Size > &dest)
void pad3(T n, fmt::basic_memory_buffer< char, Buffer_Size > &dest)
void append_buf(const fmt::basic_memory_buffer< char, Buffer_Size1 > &buf, fmt::basic_memory_buffer< char, Buffer_Size2 > &dest)
void pad6(T n, fmt::basic_memory_buffer< char, Buffer_Size > &dest)
std::enable_if< is_contiguous< Container >::value &&internal::is_string< S >::value, std::back_insert_iterator< Container > >::type format_to(std::back_insert_iterator< Container > out, const S &format_str, const Args &...args)
second seconds
Alias for common language habits.
void append_string_view(spdlog::string_view_t view, fmt::basic_memory_buffer< char, Buffer_Size > &dest)
void pad9(T n, fmt::basic_memory_buffer< char, Buffer_Size > &dest)
unsigned __int64 uint64_t
void pad_uint(T n, unsigned int width, fmt::basic_memory_buffer< char, Buffer_Size > &dest)
fmt::string_view string_view_t
const GenericPointer< typename T::ValueType > T2 value
void pad2(int n, fmt::basic_memory_buffer< char, Buffer_Size > &dest)
ToDuration time_fraction(const log_clock::time_point &tp)
spdlog::string_view_t to_string_view(const fmt::basic_memory_buffer< char, Buffer_Size > &buf) SPDLOG_NOEXCEPT
unsigned count_digits(T n)