@@ -50,20 +50,11 @@ class TagWriter {
5050 // The tags must not be duplicated in other Put* calls.
5151 void PutLogExtra (const LogExtra& extra);
5252
53- // Copies the tags to the internal LogExtra. They will be deduplicated
54- // automatically.
55- void ExtendLogExtra (const LogExtra& extra);
56-
5753private:
5854 friend class logging ::LogHelper;
5955
6056 explicit TagWriter (LogHelper& lh) noexcept ;
6157
62- void PutKey (TagKey key);
63- void PutKey (RuntimeTagKey key);
64-
65- void MarkValueEnd () noexcept ;
66-
6758 LogHelper& lh_;
6859};
6960
@@ -91,12 +82,20 @@ consteval TagKey::TagKey(const StringType& escaped_key)
9182
9283template <typename T>
9384void TagWriter::PutTag (TagKey key, const T& value) {
94- lh_.PutTag (key.GetEscapedKey (), value);
85+ if constexpr (std::is_convertible_v<T, std::string_view>) {
86+ lh_.PutSwTag (key.GetEscapedKey (), value);
87+ } else {
88+ lh_.PutTag (key.GetEscapedKey (), value);
89+ }
9590}
9691
9792template <typename T>
9893void TagWriter::PutTag (RuntimeTagKey key, const T& value) {
99- lh_.PutTag (key.GetUnescapedKey (), std::variant{value});
94+ if constexpr (std::is_convertible_v<T, std::string_view>) {
95+ lh_.PutSwTag (key.GetUnescapedKey (), value);
96+ } else {
97+ lh_.PutTag (key.GetUnescapedKey (), value);
98+ }
10099}
101100
102101} // namespace logging::impl
0 commit comments