24#include <seastar/core/sstring.hh>
25#include <seastar/util/modules.hh>
27#include <fmt/ostream.h>
28#include <fmt/printf.h>
38operator<<(std::ostream&& os,
const void* ptr) {
44template <
typename... A>
45[[deprecated(
"use std::format_to() or fmt::print()")]]
47fprint(std::ostream& os,
const char* fmt, A&&... a) {
48 ::fmt::fprintf(os, fmt, std::forward<A>(a)...);
52template <
typename... A>
53[[deprecated(
"use std::format_to() or fmt::print()")]]
55print(
const char* fmt, A&&... a) {
56 ::fmt::printf(fmt, std::forward<A>(a)...);
59template <
typename... A>
60[[deprecated(
"use std::format() or fmt::format()")]]
62sprint(
const char* fmt, A&&... a) {
63 std::ostringstream os;
64 ::fmt::fprintf(os, fmt, std::forward<A>(a)...);
68template <
typename... A>
69[[deprecated(
"use std::format() or fmt::format()")]]
71sprint(
const sstring& fmt, A&&... a) {
72 std::ostringstream os;
73 ::fmt::fprintf(os, fmt.c_str(), std::forward<A>(a)...);
77template <
typename Iterator>
78[[deprecated(
"use fmt::join()")]]
80format_separated(Iterator b, Iterator e,
const char* sep =
", ") {
93template <
typename TimePo
int>
98template <
typename TimePo
int>
101usecfmt(TimePoint tp) {
105template <
typename Clock,
typename Rep,
typename Period>
107operator<<(std::ostream& os, usecfmt_wrapper<std::chrono::time_point<Clock, std::chrono::duration<Rep, Period>>> tp) {
108 auto usec = std::chrono::duration_cast<std::chrono::microseconds>(tp.val.time_since_epoch()).count();
109 std::ostream tmp(os.rdbuf());
110 tmp << std::setw(12) << (usec / 1000000) <<
"." << std::setw(6) << std::setfill(
'0') << (usec % 1000000);
114template <
typename... A>
118 print(std::forward<A>(a)...);
130template <
typename... A>
132format(fmt::format_string<A...> fmt, A&&... a) {
133 fmt::memory_buffer out;
134 fmt::format_to(fmt::appender(out), fmt, std::forward<A>(a)...);
135 return sstring{out.data(), out.size()};
139template <
typename... A>
140[[deprecated(
"use std::format() or fmt::print()")]]
142fmt_print(std::ostream& os,
const char*
format, A&&... a) {
143 fmt::print(os,
format, std::forward<A>(a)...);
future now()
Returns a ready future.
Definition: later.hh:35
Seastar API namespace.
Definition: abort_on_ebadf.hh:26
sstring format(fmt::format_string< A... > fmt, A &&... a)
Definition: print.hh:132