2 * Copyright (C) 2024 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #ifndef LTTNG_COMMON_CTL_FORMAT_H
9 #define LTTNG_COMMON_CTL_FORMAT_H
11 #include <common/format.hpp>
13 #include <lttng/lttng.h>
16 * Due to a bug in g++ < 7.1, this specialization must be enclosed in the fmt namespace,
17 * see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480.
21 struct formatter<lttng_buffer_type> : formatter<std::string> {
22 template <typename FormatContextType>
23 typename FormatContextType::iterator format(lttng_buffer_type buffer_type,
24 FormatContextType& ctx)
26 auto name = "unknown";
28 switch (buffer_type) {
29 case LTTNG_BUFFER_PER_PID:
32 case LTTNG_BUFFER_PER_UID:
35 case LTTNG_BUFFER_GLOBAL:
40 return format_to(ctx.out(), name);
45 #endif /* LTTNG_COMMON_CTL_FORMAT_H */