184 std::string_view span_id,
185 std::optional<std::string_view> parent_span_id = std::nullopt);
197 std::optional<std::string_view> correlation_id = std::nullopt);
218 [[nodiscard]] std::optional<context_value> get(std::string_view key)
const;
234 template <
typename T>
235 [[nodiscard]] std::optional<T>
get_as(std::string_view key)
const {
236 auto value = get(key);
240 if (
auto* ptr = std::get_if<T>(&*value)) {
255 [[nodiscard]] std::string get_string(std::string_view key,
256 std::string_view default_value =
"")
const;
263 [[nodiscard]] std::optional<context_category> get_category(std::string_view key)
const;
274 [[nodiscard]]
bool has(std::string_view key)
const;
280 [[nodiscard]]
bool empty()
const;
286 [[nodiscard]]
size_t size()
const;
292 [[nodiscard]] std::vector<std::string> keys()
const;
299 [[nodiscard]] std::vector<std::string> keys(
context_category category)
const;
309 void remove(std::string_view key);
362 std::unordered_map<std::string, entry>
data_;
Unified interface for managing all types of logging context.
unified_log_context()=default
Default constructor.
std::unordered_map< std::string, entry > data_
std::optional< T > get_as(std::string_view key) const
~unified_log_context()=default
Destructor.
Data structures for representing log entries and source locations kcenon.
std::variant< std::monostate, bool, int64_t, double, std::string > context_value
Value type for unified context storage.
OpenTelemetry context structure for trace correlation kcenon.
OpenTelemetry context for trace correlation.
Internal entry structure.
context_category category