diff options
author | bulatman <[email protected]> | 2024-08-16 20:32:30 +0300 |
---|---|---|
committer | bulatman <[email protected]> | 2024-08-16 20:43:30 +0300 |
commit | 1928a19d2e6c8185a9688eaad836234db01f7146 (patch) | |
tree | e599e1d7fcb1fc11e5621ded80266fda77e7637d | |
parent | d1db686810347c4f72550bcbeb313e931ca8e756 (diff) |
YT: Replace local function with YT_DEFINE_GLOBAL
09844011ee4a54b01116b906c48f9656d032166b
-rw-r--r-- | yt/yt/core/misc/error_code.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/yt/yt/core/misc/error_code.cpp b/yt/yt/core/misc/error_code.cpp index f713cc9c8a5..3827177a716 100644 --- a/yt/yt/core/misc/error_code.cpp +++ b/yt/yt/core/misc/error_code.cpp @@ -4,6 +4,8 @@ #include <yt/yt/core/misc/singleton.h> +#include <library/cpp/yt/misc/global.h> + #include <util/string/split.h> #include <util/system/type_name.h> @@ -13,11 +15,7 @@ namespace NYT { //////////////////////////////////////////////////////////////////////////////// // TODO(achulkov2): Remove this once we find all duplicate error codes. -static NLogging::TLogger GetLogger() -{ - static NLogging::TLogger logger("ErrorCode"); - return logger; -} +YT_DEFINE_GLOBAL(NLogging::TLogger, Logger, "ErrorCode") //////////////////////////////////////////////////////////////////////////////// @@ -66,7 +64,6 @@ void TErrorCodeRegistry::RegisterErrorCode(int code, const TErrorCodeInfo& error if (code == 119) { return; } - auto Logger = GetLogger(); YT_LOG_FATAL( "Duplicate error code (Code: %v, StoredCodeInfo: %v, NewCodeInfo: %v)", code, @@ -95,7 +92,6 @@ void TErrorCodeRegistry::RegisterErrorCodeRange(int from, int to, TString namesp YT_VERIFY(from <= to); TErrorCodeRangeInfo newRange{from, to, std::move(namespaceName), std::move(formatter)}; - auto Logger = GetLogger(); for (const auto& range : ErrorCodeRanges_) { YT_LOG_FATAL_IF( range.Intersects(newRange), @@ -109,7 +105,6 @@ void TErrorCodeRegistry::RegisterErrorCodeRange(int from, int to, TString namesp void TErrorCodeRegistry::CheckCodesAgainstRanges() const { - auto Logger = GetLogger(); for (const auto& [code, info] : CodeToInfo_) { for (const auto& range : ErrorCodeRanges_) { YT_LOG_FATAL_IF( |