diff options
author | arkady-e1ppa <arkady-e1ppa@yandex-team.com> | 2024-06-14 08:07:11 +0300 |
---|---|---|
committer | arkady-e1ppa <arkady-e1ppa@yandex-team.com> | 2024-06-14 08:19:38 +0300 |
commit | f89ac54b9ed5e1902b662ef1373da3d521a9f126 (patch) | |
tree | f706d4606ef91f98d30e87034b457655eb83ffe3 | |
parent | cbaf9cb961ea53644929a396c6e9955b1332cf04 (diff) | |
download | ydb-f89ac54b9ed5e1902b662ef1373da3d521a9f126.tar.gz |
YT-21868: Fix missing anchor for single messages in YT_LOG_XXX macros
438bc5ed4e35d7a3aeffcce25e862d21289d4cad
-rw-r--r-- | library/cpp/yt/logging/logger-inl.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/library/cpp/yt/logging/logger-inl.h b/library/cpp/yt/logging/logger-inl.h index 344770dcf6..5c1f1b0b55 100644 --- a/library/cpp/yt/logging/logger-inl.h +++ b/library/cpp/yt/logging/logger-inl.h @@ -213,7 +213,20 @@ TLogMessage BuildLogMessage( AppendMessageTags(&builder, loggingContext, logger); builder.AppendChar(')'); } - return {builder.Flush(), TStringBuf()}; + + if constexpr (std::same_as<TStringBuf, std::remove_cvref_t<T>>) { + // NB(arkady-e1ppa): This is the overload where TStringBuf + // falls as well as zero-argument format strings. + // Formerly (before static analysis) there was a special overload + // which guaranteed that Anchor is set to the value of said TStringBuf + // object. Now we have overload for TFormatString<> which fordids + // us having overload for TStringBuf (both have implicit ctors from + // string literals) thus we have to accommodate TStringBuf specifics + // in this if constexpr part. + return {builder.Flush(), obj}; + } else { + return {builder.Flush(), TStringBuf()}; + } } inline TLogMessage BuildLogMessage( |