77#include < cstddef>
88#include < cstring>
99#include < format>
10+ #include < iterator>
1011#include < span>
1112#include < string_view>
1213#include < type_traits>
@@ -36,10 +37,10 @@ using wrapped_arg_t = std::invoke_result_t<decltype(impl::wrap_log_argument<T>),
3637
3738template <typename ... Args>
3839size_t format_log_message (std::span<char > message_buffer, std::format_string<impl::wrapped_arg_t <Args>...> fmt, Args&&... args) noexcept {
39- auto [out, size ]{std::format_to_n<decltype (message_buffer.data ()), impl::wrapped_arg_t <Args>...>(message_buffer.data (), message_buffer.size () - 1 , fmt,
40- impl::wrap_log_argument (std::forward<Args>(args))...)};
40+ auto [out, _ ]{std::format_to_n<decltype (message_buffer.data ()), impl::wrapped_arg_t <Args>...>(message_buffer.data (), message_buffer.size () - 1 , fmt,
41+ impl::wrap_log_argument (std::forward<Args>(args))...)};
4142 *out = ' \0 ' ;
42- return size ;
43+ return std::distance (message_buffer. data (), out) ;
4344}
4445
4546inline size_t resolve_log_trace (std::span<char > trace_buffer, std::span<void * const > raw_trace) noexcept {
@@ -48,18 +49,18 @@ inline size_t resolve_log_trace(std::span<char> trace_buffer, std::span<void* co
4849 }
4950
5051 if (auto backtrace_symbols{kphp::diagnostic::backtrace_symbols (raw_trace)}; !backtrace_symbols.empty ()) {
51- const auto [trace_out, trace_size ]{std::format_to_n (trace_buffer.data (), trace_buffer.size () - 1 , " \n {}" , backtrace_symbols)};
52+ const auto [trace_out, _ ]{std::format_to_n (trace_buffer.data (), trace_buffer.size () - 1 , " \n {}" , backtrace_symbols)};
5253 *trace_out = ' \0 ' ;
53- return trace_size ;
54+ return std::distance (trace_buffer. data (), trace_out) ;
5455 } else if (auto backtrace_addresses{kphp::diagnostic::backtrace_addresses (raw_trace)}; !backtrace_addresses.empty ()) {
55- const auto [trace_out, trace_size ]{std::format_to_n (trace_buffer.data (), trace_buffer.size () - 1 , " {}" , backtrace_addresses)};
56+ const auto [trace_out, _ ]{std::format_to_n (trace_buffer.data (), trace_buffer.size () - 1 , " {}" , backtrace_addresses)};
5657 *trace_out = ' \0 ' ;
57- return trace_size ;
58+ return std::distance (trace_buffer. data (), trace_out) ;
5859 } else {
5960 static constexpr std::string_view DEFAULT_TRACE = " []" ;
60- const auto [trace_out, trace_size ]{std::format_to_n (trace_buffer.data (), trace_buffer.size () - 1 , " {}" , DEFAULT_TRACE)};
61+ const auto [trace_out, _ ]{std::format_to_n (trace_buffer.data (), trace_buffer.size () - 1 , " {}" , DEFAULT_TRACE)};
6162 *trace_out = ' \0 ' ;
62- return trace_size ;
63+ return std::distance (trace_buffer. data (), trace_out) ;
6364 }
6465}
6566
0 commit comments