6#include <initializer_list>
11#include <boost/container/container_fwd.hpp>
13#include <userver/compiler/select.hpp>
14#include <userver/logging/fwd.hpp>
15#include <userver/utils/fast_pimpl.hpp>
17USERVER_NAMESPACE_BEGIN
39 std::variant<std::string,
int,
long,
long long,
unsigned int,
unsigned long,
unsigned long long,
float,
double>;
40 using Key = std::string;
41 using Pair = std::pair<Key, Value>;
51 LogExtra(
const LogExtra&);
59 LogExtra& operator=(LogExtra&&);
61 LogExtra& operator=(
const LogExtra&);
102 template <
typename Iterator>
105 for (Iterator it = first; it != last; ++it) Extend(*it, extend_type);
112 friend class impl::TagWriter;
117 const Value& GetValue(std::string_view key)
const;
119 class ProtectedValue
final {
121 ProtectedValue() =
default;
122 ProtectedValue(Value value,
bool frozen);
123 ProtectedValue(
const ProtectedValue& other) =
default;
124 ProtectedValue(ProtectedValue&& other) =
default;
126 ProtectedValue& operator=(
const ProtectedValue& other);
127 ProtectedValue& operator=(ProtectedValue&& other)
noexcept;
129 bool IsFrozen()
const;
131 Value& GetValue() {
return value_; }
132 const Value& GetValue()
const {
return value_; }
133 void AssignIgnoringFrozenness(ProtectedValue other);
137 bool frozen_ =
false;
140 static constexpr std::size_t kSmallVectorSize = 24;
141 static constexpr std::size_t kPimplSize =
142 compiler::SelectSize().ForLibCpp32(1168).ForLibCpp64(1560).ForLibStdCpp64(1944).ForLibStdCpp32(1356);
143 using MapItem = std::pair<Key, ProtectedValue>;
144 using Map = boost::container::small_vector<MapItem, kSmallVectorSize>;
150 std::pair<Key, ProtectedValue>* Find(std::string_view);
152 const std::pair<Key, ProtectedValue>* Find(std::string_view)
const;
154 utils::FastPimpl<Map, kPimplSize,
alignof(
void*)> extra_;
157extern const LogExtra kEmptyLogExtra;