summaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/logging/structured_payload.h
blob: 81464f4aa9295dc05432b8a2d87e22547ea19385 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#pragma once

#include "public.h"

#include <library/cpp/yt/memory/ref.h>

#include <library/cpp/yt/yson_string/string.h>

namespace NYT::NLogging {

////////////////////////////////////////////////////////////////////////////////

// Structured events carry the raw YSON map fragment as their opaque payload, with no
// framing. These helpers isolate that representation from callers.

//! Producer: wraps #message into a payload (zero-copy).
TStructuredLogEventPayload MakeStructuredPayloadFromYson(const NYson::TYsonString& message);

//! Consumer: views the payload as the YSON map fragment it carries. The result views
//! into #payload, which must outlive it.
NYson::TYsonStringBuf GetYsonFromStructuredPayload(const TStructuredLogEventPayload& payload);

////////////////////////////////////////////////////////////////////////////////

} // namespace NYT::NLogging