in `PG::do_update_log_missing()`, `std::optional<eversion_t>` is printed
using {fmt}, but {fmt} does not support formatting `std::optional<>`. so
we need to swing our own formatter. we can promote this formatter to
a more common place if it is proved to be useful otherwhere in the
source tree.
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
}
}
+template <typename T>
+struct fmt::formatter<std::optional<T>> : fmt::formatter<T> {
+ template <typename FormatContext>
+ auto format(const std::optional<T>& v, FormatContext& ctx) const {
+ if (v.has_value()) {
+ return fmt::formatter<T>::format(*v, ctx);
+ }
+ return fmt::format_to(ctx.out(), "<null>");
+ }
+};
+
namespace crimson::osd {
using crimson::common::local_conf;