diff options
author | nadya02 <nadya02@yandex-team.com> | 2024-05-22 15:47:35 +0300 |
---|---|---|
committer | nadya02 <nadya02@yandex-team.com> | 2024-05-22 16:03:37 +0300 |
commit | 3ca52abbf1a2f85ef2ee907a12e293549dc36aad (patch) | |
tree | 3ff5de16d341a7123154d52dd422d36f3ff2e67c /yt | |
parent | 1f0614780d5f4587feaee32137b862e4dc00b87f (diff) | |
download | ydb-3ca52abbf1a2f85ef2ee907a12e293549dc36aad.tar.gz |
Apply to global loggers in yt/yt
2099bd8ce11fc2c9e0566ebafbb9fddf4dad5141
Diffstat (limited to 'yt')
59 files changed, 74 insertions, 75 deletions
diff --git a/yt/yt/client/api/client.cpp b/yt/yt/client/api/client.cpp index be231d8ebf..7c5e3beb07 100644 --- a/yt/yt/client/api/client.cpp +++ b/yt/yt/client/api/client.cpp @@ -15,7 +15,7 @@ using namespace NYTree; //////////////////////////////////////////////////////////////////////////////// -static const auto& Logger = ApiLogger; +static constexpr auto& Logger = ApiLogger; //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/api/persistent_queue.cpp b/yt/yt/client/api/persistent_queue.cpp index 1e334e7f7a..b75702a14d 100644 --- a/yt/yt/client/api/persistent_queue.cpp +++ b/yt/yt/client/api/persistent_queue.cpp @@ -83,7 +83,7 @@ public: , StateTablePath_(stateTablePath) , TabletIndexes_(PrepareTabletIndexes(tabletIndexes)) , PollerId_(TGuid::Create()) - , Logger(ApiLogger.WithTag("PollerId: %v", PollerId_)) + , Logger(ApiLogger().WithTag("PollerId: %v", PollerId_)) , Invoker_(Client_->GetConnection()->GetInvoker()) { YT_VERIFY(Config_); diff --git a/yt/yt/client/api/private.h b/yt/yt/client/api/private.h index 60a8f6a4fa..4a4e6567fe 100644 --- a/yt/yt/client/api/private.h +++ b/yt/yt/client/api/private.h @@ -8,7 +8,7 @@ namespace NYT::NApi { //////////////////////////////////////////////////////////////////////////////// -inline const NLogging::TLogger ApiLogger("Api"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, ApiLogger, "Api"); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/api/rpc_proxy/client_impl.cpp b/yt/yt/client/api/rpc_proxy/client_impl.cpp index 37d17eacbf..176b6f5294 100644 --- a/yt/yt/client/api/rpc_proxy/client_impl.cpp +++ b/yt/yt/client/api/rpc_proxy/client_impl.cpp @@ -78,7 +78,7 @@ TClient::TClient( &CreateTableMountCache, Connection_->GetConfig()->TableMountCache, RetryingChannel_, - RpcProxyClientLogger, + RpcProxyClientLogger(), Connection_->GetConfig()->RpcTimeout)) , TimestampProvider_(BIND(&TClient::CreateTimestampProvider, Unretained(this))) { } diff --git a/yt/yt/client/api/rpc_proxy/connection_impl.cpp b/yt/yt/client/api/rpc_proxy/connection_impl.cpp index f2ec4bb2e3..9e87f1ccae 100644 --- a/yt/yt/client/api/rpc_proxy/connection_impl.cpp +++ b/yt/yt/client/api/rpc_proxy/connection_impl.cpp @@ -227,7 +227,7 @@ TConnection::TConnection(TConnectionConfigPtr config, TConnectionOptions options , ConnectionId_(TGuid::Create()) , LoggingTag_(MakeConnectionLoggingTag(Config_, ConnectionId_)) , ClusterId_(MakeConnectionClusterId(Config_)) - , Logger(RpcProxyClientLogger.WithRawTag(LoggingTag_)) + , Logger(RpcProxyClientLogger().WithRawTag(LoggingTag_)) , ChannelFactory_(Config_->ProxyUnixDomainSocket ? NRpc::NBus::CreateUdsBusChannelFactory(Config_->BusClient) : NRpc::NBus::CreateTcpBusChannelFactory(Config_->BusClient)) diff --git a/yt/yt/client/api/rpc_proxy/private.h b/yt/yt/client/api/rpc_proxy/private.h index 78011d2768..4c2eae9aa5 100644 --- a/yt/yt/client/api/rpc_proxy/private.h +++ b/yt/yt/client/api/rpc_proxy/private.h @@ -22,7 +22,7 @@ DECLARE_REFCOUNTED_CLASS(TClientBase) DECLARE_REFCOUNTED_CLASS(TClient) DECLARE_REFCOUNTED_CLASS(TTransaction) -inline const NLogging::TLogger RpcProxyClientLogger("RpcProxyClient"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, RpcProxyClientLogger, "RpcProxyClient"); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/api/rpc_proxy/transaction_impl.cpp b/yt/yt/client/api/rpc_proxy/transaction_impl.cpp index a5819f423a..d451b755b8 100644 --- a/yt/yt/client/api/rpc_proxy/transaction_impl.cpp +++ b/yt/yt/client/api/rpc_proxy/transaction_impl.cpp @@ -53,7 +53,7 @@ TTransaction::TTransaction( , PingPeriod_(pingPeriod) , StickyProxyAddress_(stickyParameters ? std::move(stickyParameters->ProxyAddress) : TString()) , SequenceNumberSourceId_(sequenceNumberSourceId) - , Logger(RpcProxyClientLogger.WithTag("TransactionId: %v, %v", + , Logger(RpcProxyClientLogger().WithTag("TransactionId: %v, %v", Id_, Connection_->GetLoggingTag())) , Proxy_(Channel_) diff --git a/yt/yt/client/arrow/arrow_row_stream_encoder.cpp b/yt/yt/client/arrow/arrow_row_stream_encoder.cpp index c36c6724a1..65701a56db 100644 --- a/yt/yt/client/arrow/arrow_row_stream_encoder.cpp +++ b/yt/yt/client/arrow/arrow_row_stream_encoder.cpp @@ -26,7 +26,7 @@ using namespace NTableClient; //////////////////////////////////////////////////////////////////////////////// -static const auto& Logger = ArrowLogger; +static constexpr auto& Logger = ArrowLogger; //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/arrow/public.h b/yt/yt/client/arrow/public.h index 8830264345..f3a39fbfdf 100644 --- a/yt/yt/client/arrow/public.h +++ b/yt/yt/client/arrow/public.h @@ -6,8 +6,8 @@ namespace NYT::NArrow { //////////////////////////////////////////////////////////////////////////////// -inline const NLogging::TLogger ArrowLogger("Arrow"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, ArrowLogger, "Arrow"); //////////////////////////////////////////////////////////////////////////////// -} // namespace NYT::NArrow
\ No newline at end of file +} // namespace NYT::NArrow diff --git a/yt/yt/client/driver/command.h b/yt/yt/client/driver/command.h index c870df7f1a..043a28aa77 100644 --- a/yt/yt/client/driver/command.h +++ b/yt/yt/client/driver/command.h @@ -73,7 +73,7 @@ class TCommandBase , public ICommand { protected: - NLogging::TLogger Logger = DriverLogger; + NLogging::TLogger Logger = DriverLogger(); virtual void DoExecute(ICommandContextPtr ) { }; virtual bool HasResponseParameters() const; diff --git a/yt/yt/client/driver/driver.cpp b/yt/yt/client/driver/driver.cpp index 9371be5f03..d3377c0806 100644 --- a/yt/yt/client/driver/driver.cpp +++ b/yt/yt/client/driver/driver.cpp @@ -58,7 +58,7 @@ using namespace NTracing; //////////////////////////////////////////////////////////////////////////////// -static const auto& Logger = DriverLogger; +static constexpr auto& Logger = DriverLogger; //////////////////////////////////////////////////////////////////////////////// @@ -125,7 +125,7 @@ public: , ProxyDiscoveryCache_(CreateProxyDiscoveryCache( Config_->ProxyDiscoveryCache, RootClient_)) - , StickyTransactionPool_(CreateStickyTransactionPool(Logger)) + , StickyTransactionPool_(CreateStickyTransactionPool(Logger())) { // Register all commands. #define REGISTER(command, name, inDataType, outDataType, isVolatile, isHeavy, version) \ @@ -528,9 +528,8 @@ private: { const auto& request = context->Request(); - auto Logger = DriverLogger; if (request.LoggingTags) { - Logger.WithRawTag(*request.LoggingTags); + Logger().WithRawTag(*request.LoggingTags); } NTracing::TChildTraceContextGuard commandSpan(ConcatToString(TStringBuf("Driver:"), request.CommandName)); diff --git a/yt/yt/client/driver/private.h b/yt/yt/client/driver/private.h index d7fa243b11..8c8440e58b 100644 --- a/yt/yt/client/driver/private.h +++ b/yt/yt/client/driver/private.h @@ -13,7 +13,7 @@ DECLARE_REFCOUNTED_STRUCT(ICommandContext) //////////////////////////////////////////////////////////////////////////////// -inline const NLogging::TLogger DriverLogger("Driver"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, DriverLogger, "Driver"); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/driver/proxy_discovery_cache.cpp b/yt/yt/client/driver/proxy_discovery_cache.cpp index ef32e71b0f..6d98deb970 100644 --- a/yt/yt/client/driver/proxy_discovery_cache.cpp +++ b/yt/yt/client/driver/proxy_discovery_cache.cpp @@ -62,7 +62,7 @@ public: IClientPtr client) : TAsyncExpiringCache( std::move(config), - DriverLogger.WithTag("Cache: ProxyDiscovery")) + DriverLogger().WithTag("Cache: ProxyDiscovery")) , Client_(std::move(client)) { } diff --git a/yt/yt/client/driver/scheduler_commands.cpp b/yt/yt/client/driver/scheduler_commands.cpp index d727a6874f..782e923abe 100644 --- a/yt/yt/client/driver/scheduler_commands.cpp +++ b/yt/yt/client/driver/scheduler_commands.cpp @@ -25,7 +25,7 @@ using namespace NJobTrackerClient; //////////////////////////////////////////////////////////////////////////////// -static inline const NLogging::TLogger JobShellStructuredLogger("JobShell"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, JobShellStructuredLogger, "JobShell"); //////////////////////////////////////////////////////////////////////////////// @@ -592,7 +592,7 @@ void TPollJobShellCommand::DoExecute(ICommandContextPtr context) .ValueOrThrow(); if (response.LoggingContext) { - LogStructuredEventFluently(JobShellStructuredLogger, NLogging::ELogLevel::Info) + LogStructuredEventFluently(JobShellStructuredLogger(), NLogging::ELogLevel::Info) .Do([&] (TFluentMap fluent) { fluent.GetConsumer()->OnRaw(response.LoggingContext); }) diff --git a/yt/yt/client/federated/client.cpp b/yt/yt/client/federated/client.cpp index 32bc9bfdbe..a915ee5a98 100644 --- a/yt/yt/client/federated/client.cpp +++ b/yt/yt/client/federated/client.cpp @@ -30,7 +30,7 @@ using namespace NApi; //////////////////////////////////////////////////////////////////////////////// -static const auto& Logger = FederatedClientLogger; +static constexpr auto& Logger = FederatedClientLogger; //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/federated/private.h b/yt/yt/client/federated/private.h index 6762c79ff2..1e028e828d 100644 --- a/yt/yt/client/federated/private.h +++ b/yt/yt/client/federated/private.h @@ -8,7 +8,7 @@ namespace NYT::NClient::NFederated { //////////////////////////////////////////////////////////////////////////////// -inline const NLogging::TLogger FederatedClientLogger("FederatedClient"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, FederatedClientLogger, "FederatedClient"); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/formats/public.h b/yt/yt/client/formats/public.h index cb258a5cfd..0ac2a23471 100644 --- a/yt/yt/client/formats/public.h +++ b/yt/yt/client/formats/public.h @@ -91,7 +91,7 @@ class TFormat; //////////////////////////////////////////////////////////////////////////////// -inline const NLogging::TLogger FormatsLogger("Formats"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, FormatsLogger, "Formats"); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/node_tracker_client/node_directory.cpp b/yt/yt/client/node_tracker_client/node_directory.cpp index 8388b6a302..84b2a1d6ec 100644 --- a/yt/yt/client/node_tracker_client/node_directory.cpp +++ b/yt/yt/client/node_tracker_client/node_directory.cpp @@ -35,7 +35,7 @@ using NYT::ToProto; //////////////////////////////////////////////////////////////////////////////// -static const auto& Logger = NodeTrackerClientLogger; +static constexpr auto& Logger = NodeTrackerClientLogger; //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/node_tracker_client/private.h b/yt/yt/client/node_tracker_client/private.h index 162e8bd259..a34f8bc307 100644 --- a/yt/yt/client/node_tracker_client/private.h +++ b/yt/yt/client/node_tracker_client/private.h @@ -8,7 +8,7 @@ namespace NYT::NNodeTrackerClient { //////////////////////////////////////////////////////////////////////////////// -inline const NLogging::TLogger NodeTrackerClientLogger("NodeTrackerClient"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, NodeTrackerClientLogger, "NodeTrackerClient"); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/queue_client/consumer_client.cpp b/yt/yt/client/queue_client/consumer_client.cpp index 1333e1c7b7..656972c76b 100644 --- a/yt/yt/client/queue_client/consumer_client.cpp +++ b/yt/yt/client/queue_client/consumer_client.cpp @@ -39,7 +39,7 @@ using namespace NYTree; //////////////////////////////////////////////////////////////////////////////// -static const auto& Logger = QueueClientLogger; +static constexpr auto& Logger = QueueClientLogger; //////////////////////////////////////////////////////////////////////////////// @@ -542,7 +542,7 @@ private: QueueClusterClient_, std::move(tabletAndRowIndices), params, - Logger)); + Logger())); if (!partitionRowInfosOrError.IsOK()) { YT_LOG_DEBUG(partitionRowInfosOrError, "Failed to get partition row infos (Path: %v)", diff --git a/yt/yt/client/queue_client/partition_reader.cpp b/yt/yt/client/queue_client/partition_reader.cpp index e127c5f283..d02774cd1f 100644 --- a/yt/yt/client/queue_client/partition_reader.cpp +++ b/yt/yt/client/queue_client/partition_reader.cpp @@ -35,7 +35,7 @@ public: , Client_(std::move(client)) , ConsumerPath_(std::move(consumerPath)) , PartitionIndex_(partitionIndex) - , Logger(QueueClientLogger.WithTag("Consumer: %v, Partition: %v", ConsumerPath_, PartitionIndex_)) + , Logger(QueueClientLogger().WithTag("Consumer: %v, Partition: %v", ConsumerPath_, PartitionIndex_)) , RowBatchReadOptions_({Config_->MaxRowCount, Config_->MaxDataWeight, Config_->DataWeightPerRowHint}) , PullQueueOptions_({.UseNativeTabletNodeApi = Config_->UseNativeTabletNodeApi}) { } @@ -271,7 +271,7 @@ public: , QueuePath_(std::move(queuePath)) , PartitionIndex_(partitionIndex) , RowBatchReadOptions_({Config_->MaxRowCount, Config_->MaxDataWeight, Config_->DataWeightPerRowHint}) - , Logger(QueueClientLogger.WithTag("Consumer: %v, Queue: %v, Partition: %v", ConsumerPath_, QueuePath_, PartitionIndex_)) + , Logger(QueueClientLogger().WithTag("Consumer: %v, Queue: %v, Partition: %v", ConsumerPath_, QueuePath_, PartitionIndex_)) { PullConsumerOptions_.UseNativeTabletNodeApi = Config_->UseNativeTabletNodeApi; } diff --git a/yt/yt/client/queue_client/private.h b/yt/yt/client/queue_client/private.h index 9b88a00d1e..6ff1c5661f 100644 --- a/yt/yt/client/queue_client/private.h +++ b/yt/yt/client/queue_client/private.h @@ -6,7 +6,7 @@ namespace NYT::NQueueClient { //////////////////////////////////////////////////////////////////////////////// -inline const NLogging::TLogger QueueClientLogger("QueueClient"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, QueueClientLogger, "QueueClient"); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/scheduler/operation_cache.cpp b/yt/yt/client/scheduler/operation_cache.cpp index 4b7a197d29..4c82127a37 100644 --- a/yt/yt/client/scheduler/operation_cache.cpp +++ b/yt/yt/client/scheduler/operation_cache.cpp @@ -17,7 +17,7 @@ TOperationCache::TOperationCache( NProfiling::TProfiler profiler) : TAsyncExpiringCache( std::move(config), - SchedulerLogger.WithTag("Cache: Operation"), + SchedulerLogger().WithTag("Cache: Operation"), std::move(profiler)) , Attributes_(std::move(attributes)) , Client_(std::move(client)) diff --git a/yt/yt/client/scheduler/private.h b/yt/yt/client/scheduler/private.h index 736361c878..41917b732d 100644 --- a/yt/yt/client/scheduler/private.h +++ b/yt/yt/client/scheduler/private.h @@ -8,7 +8,7 @@ namespace NYT::NScheduler { //////////////////////////////////////////////////////////////////////////////// -inline const NLogging::TLogger SchedulerLogger("Scheduler"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, SchedulerLogger, "Scheduler"); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/table_client/comparator.cpp b/yt/yt/client/table_client/comparator.cpp index 34aefde9db..0d215415fe 100644 --- a/yt/yt/client/table_client/comparator.cpp +++ b/yt/yt/client/table_client/comparator.cpp @@ -15,7 +15,7 @@ using namespace NYson; using namespace NYTree; //! Used only for YT_LOG_FATAL below. -static const TLogger Logger("TableClientComparator"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, Logger, "TableClientComparator"); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/table_client/key.cpp b/yt/yt/client/table_client/key.cpp index 92953c792d..e2a7f67d44 100644 --- a/yt/yt/client/table_client/key.cpp +++ b/yt/yt/client/table_client/key.cpp @@ -13,7 +13,7 @@ using namespace NYson; //////////////////////////////////////////////////////////////////////////////// //! Used only for YT_LOG_FATAL below. -static const TLogger Logger("TableClientKey"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, Logger, "TableClientKey"); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/table_client/key_bound.cpp b/yt/yt/client/table_client/key_bound.cpp index 6428d87e4e..a4612c0df1 100644 --- a/yt/yt/client/table_client/key_bound.cpp +++ b/yt/yt/client/table_client/key_bound.cpp @@ -15,7 +15,7 @@ using namespace NLogging; //////////////////////////////////////////////////////////////////////////////// //! Used only for YT_LOG_FATAL below. -static const TLogger Logger("TableClientKey"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, Logger, "TableClientKey"); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/transaction_client/private.h b/yt/yt/client/transaction_client/private.h index 24c8359ee4..49fe0b5acc 100644 --- a/yt/yt/client/transaction_client/private.h +++ b/yt/yt/client/transaction_client/private.h @@ -6,7 +6,7 @@ namespace NYT::NTransactionClient { //////////////////////////////////////////////////////////////////////////////// -inline const NLogging::TLogger TransactionClientLogger("TransactionClient"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, TransactionClientLogger, "TransactionClient"); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/transaction_client/remote_timestamp_provider.cpp b/yt/yt/client/transaction_client/remote_timestamp_provider.cpp index 39ac63f605..00def063ee 100644 --- a/yt/yt/client/transaction_client/remote_timestamp_provider.cpp +++ b/yt/yt/client/transaction_client/remote_timestamp_provider.cpp @@ -22,7 +22,7 @@ using namespace NConcurrency; //////////////////////////////////////////////////////////////////////////////// -static const auto& Logger = TransactionClientLogger; +static constexpr auto& Logger = TransactionClientLogger; //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/transaction_client/timestamp_provider_base.cpp b/yt/yt/client/transaction_client/timestamp_provider_base.cpp index 7ae5f96c52..3971b897a1 100644 --- a/yt/yt/client/transaction_client/timestamp_provider_base.cpp +++ b/yt/yt/client/transaction_client/timestamp_provider_base.cpp @@ -13,7 +13,7 @@ using namespace NObjectClient; //////////////////////////////////////////////////////////////////////////////// -static const auto& Logger = TransactionClientLogger; +static constexpr auto& Logger = TransactionClientLogger; //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/core/concurrency/fair_throttler.cpp b/yt/yt/core/concurrency/fair_throttler.cpp index aca2725c06..d3ca418340 100644 --- a/yt/yt/core/concurrency/fair_throttler.cpp +++ b/yt/yt/core/concurrency/fair_throttler.cpp @@ -657,7 +657,7 @@ IThroughputThrottlerPtr TFairThrottler::CreateBucketThrottler( } auto throttler = New<TBucketThrottler>( - Logger.WithTag("Bucket: %v", name), + Logger().WithTag("Bucket: %v", name), Profiler_.WithTag("bucket", name), SharedBucket_, Config_); diff --git a/yt/yt/core/concurrency/unittests/fair_throttler_ut.cpp b/yt/yt/core/concurrency/unittests/fair_throttler_ut.cpp index 5646e3360e..41ee845af7 100644 --- a/yt/yt/core/concurrency/unittests/fair_throttler_ut.cpp +++ b/yt/yt/core/concurrency/unittests/fair_throttler_ut.cpp @@ -71,7 +71,7 @@ struct TFairThrottlerTest { Config->TotalLimit = 100; - auto logger = Logger.WithTag("Test: %v", ::testing::UnitTest::GetInstance()->current_test_info()->name()); + auto logger = Logger().WithTag("Test: %v", ::testing::UnitTest::GetInstance()->current_test_info()->name()); FairThrottler = New<TFairThrottler>(Config, logger, NProfiling::TProfiler{}); } }; @@ -289,7 +289,7 @@ struct TFairThrottlerIPCTest Config->IPCPath = GetOutputPath() / (testName + ".throttler"); Config->TotalLimit = 100; - auto logger = Logger.WithTag("Test: %v", testName); + auto logger = Logger().WithTag("Test: %v", testName); DatNode = New<TFairThrottler>(Config, logger.WithTag("Node: dat"), NProfiling::TProfiler{}); ExeNode = New<TFairThrottler>(Config, logger.WithTag("Node: exe"), NProfiling::TProfiler{}); diff --git a/yt/yt/core/concurrency/unittests/throughput_throttler_ut.cpp b/yt/yt/core/concurrency/unittests/throughput_throttler_ut.cpp index ce9a313951..f87e4140cf 100644 --- a/yt/yt/core/concurrency/unittests/throughput_throttler_ut.cpp +++ b/yt/yt/core/concurrency/unittests/throughput_throttler_ut.cpp @@ -18,7 +18,7 @@ using namespace testing; //////////////////////////////////////////////////////////////////////////////// -static const TLogger Logger("Test"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, Logger, "Test"); //////////////////////////////////////////////////////////////////////////////// @@ -324,7 +324,7 @@ public: Config_->MaxPrefetchAmount = 1 << 30; Config_->Window = TDuration::MilliSeconds(100); - Throttler_ = CreatePrefetchingThrottler(Config_, Underlying_, Logger); + Throttler_ = CreatePrefetchingThrottler(Config_, Underlying_, Logger()); } protected: @@ -459,7 +459,7 @@ public: Config_->MaxPrefetchAmount = 1 << 30; Config_->Window = TDuration::Seconds(1); - Throttler_ = CreatePrefetchingThrottler(Config_, Underlying_, Logger); + Throttler_ = CreatePrefetchingThrottler(Config_, Underlying_, Logger()); } protected: diff --git a/yt/yt/core/crypto/tls.cpp b/yt/yt/core/crypto/tls.cpp index 8144fb7ced..70f85c0549 100644 --- a/yt/yt/core/crypto/tls.cpp +++ b/yt/yt/core/crypto/tls.cpp @@ -28,7 +28,7 @@ using namespace NNet; using namespace NConcurrency; using namespace NLogging; -static const TLogger Logger{"Tls"}; +YT_DEFINE_GLOBAL(const NLogging::TLogger, Logger, "Tls"); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/core/https/server.cpp b/yt/yt/core/https/server.cpp index 4f7179823b..16b1423615 100644 --- a/yt/yt/core/https/server.cpp +++ b/yt/yt/core/https/server.cpp @@ -17,7 +17,7 @@ namespace NYT::NHttps { -static const auto& Logger = NHttp::HttpLogger; +static constexpr auto& Logger = NHttp::HttpLogger; using namespace NNet; using namespace NHttp; diff --git a/yt/yt/core/logging/file_log_writer.cpp b/yt/yt/core/logging/file_log_writer.cpp index d94293fd18..89d9b50d93 100644 --- a/yt/yt/core/logging/file_log_writer.cpp +++ b/yt/yt/core/logging/file_log_writer.cpp @@ -21,7 +21,7 @@ using namespace NProfiling; //////////////////////////////////////////////////////////////////////////////// -static const TLogger Logger(SystemLoggingCategoryName); +YT_DEFINE_GLOBAL(const NLogging::TLogger, Logger, SystemLoggingCategoryName); static constexpr size_t BufferSize = 64_KB; //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/core/logging/formatter.cpp b/yt/yt/core/logging/formatter.cpp index 7c468c16b7..fe9c92b117 100644 --- a/yt/yt/core/logging/formatter.cpp +++ b/yt/yt/core/logging/formatter.cpp @@ -18,7 +18,7 @@ using namespace NYson; //////////////////////////////////////////////////////////////////////////////// -static const TLogger Logger(SystemLoggingCategoryName); +YT_DEFINE_GLOBAL(const NLogging::TLogger, Logger, SystemLoggingCategoryName); namespace { @@ -26,7 +26,7 @@ TLogEvent GetStartLogEvent() { TLogEvent event; event.Instant = GetCpuInstant(); - event.Category = Logger.GetCategory(); + event.Category = Logger().GetCategory(); event.Level = ELogLevel::Info; event.MessageRef = TSharedRef::FromString(Format("Logging started (Version: %v, BuildHost: %v, BuildTime: %v)", GetVersion(), @@ -40,7 +40,7 @@ TLogEvent GetStartLogStructuredEvent() { TLogEvent event; event.Instant = GetCpuInstant(); - event.Category = Logger.GetCategory(); + event.Category = Logger().GetCategory(); event.Level = ELogLevel::Info; event.MessageRef = BuildYsonStringFluently<NYson::EYsonType::MapFragment>() .Item("message").Value("Logging started") @@ -57,7 +57,7 @@ TLogEvent GetSkippedLogEvent(i64 count, TStringBuf skippedBy) { TLogEvent event; event.Instant = GetCpuInstant(); - event.Category = Logger.GetCategory(); + event.Category = Logger().GetCategory(); event.Level = ELogLevel::Info; event.MessageRef = TSharedRef::FromString(Format("Skipped log records in last second (Count: %v, SkippedBy: %v)", count, @@ -70,7 +70,7 @@ TLogEvent GetSkippedLogStructuredEvent(i64 count, TStringBuf skippedBy) { TLogEvent event; event.Instant = GetCpuInstant(); - event.Category = Logger.GetCategory(); + event.Category = Logger().GetCategory(); event.Level = ELogLevel::Info; event.MessageRef = BuildYsonStringFluently<NYson::EYsonType::MapFragment>() .Item("message").Value("Events skipped") diff --git a/yt/yt/core/logging/log_manager.cpp b/yt/yt/core/logging/log_manager.cpp index 12a0cf482b..81a2a4b1d7 100644 --- a/yt/yt/core/logging/log_manager.cpp +++ b/yt/yt/core/logging/log_manager.cpp @@ -80,7 +80,7 @@ using namespace NTracing; //////////////////////////////////////////////////////////////////////////////// -static const TLogger Logger(SystemLoggingCategoryName); +YT_DEFINE_GLOBAL(const NLogging::TLogger, Logger, SystemLoggingCategoryName); static constexpr auto DiskProfilingPeriod = TDuration::Minutes(5); static constexpr auto AnchorProfilingPeriod = TDuration::Seconds(15); diff --git a/yt/yt/core/misc/fs.cpp b/yt/yt/core/misc/fs.cpp index 20e97165a4..8092aaa850 100644 --- a/yt/yt/core/misc/fs.cpp +++ b/yt/yt/core/misc/fs.cpp @@ -41,7 +41,7 @@ namespace NYT::NFS { //////////////////////////////////////////////////////////////////////////////// -static inline const NLogging::TLogger Logger("FS"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, Logger, "FS"); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/core/misc/proc.cpp b/yt/yt/core/misc/proc.cpp index 2518ad1699..b351396aae 100644 --- a/yt/yt/core/misc/proc.cpp +++ b/yt/yt/core/misc/proc.cpp @@ -64,7 +64,7 @@ namespace NYT { //////////////////////////////////////////////////////////////////////////////// -static inline const NLogging::TLogger Logger("Proc"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, Logger, "Proc"); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/core/misc/protobuf_helpers.cpp b/yt/yt/core/misc/protobuf_helpers.cpp index d03c416575..3a1913eaa2 100644 --- a/yt/yt/core/misc/protobuf_helpers.cpp +++ b/yt/yt/core/misc/protobuf_helpers.cpp @@ -27,7 +27,7 @@ using namespace NYson; //////////////////////////////////////////////////////////////////////////////// -static const NLogging::TLogger Logger("Serialize"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, Logger, "Serialize"); struct TSerializedMessageTag { }; diff --git a/yt/yt/core/rpc/bus/channel.cpp b/yt/yt/core/rpc/bus/channel.cpp index ba47fba03d..280bda4c18 100644 --- a/yt/yt/core/rpc/bus/channel.cpp +++ b/yt/yt/core/rpc/bus/channel.cpp @@ -43,7 +43,7 @@ using NYT::ToProto; //////////////////////////////////////////////////////////////////////////////// -static const auto& Logger = RpcClientLogger; +static constexpr auto& Logger = RpcClientLogger; //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/core/rpc/dynamic_channel_pool.cpp b/yt/yt/core/rpc/dynamic_channel_pool.cpp index 92a33a2426..67b5353fe5 100644 --- a/yt/yt/core/rpc/dynamic_channel_pool.cpp +++ b/yt/yt/core/rpc/dynamic_channel_pool.cpp @@ -475,7 +475,7 @@ private: public: TPeerPoller(TImpl* owner, TString peerAddress) : Owner_(owner) - , Logger(owner->Logger.WithTag("Address: %v", peerAddress)) + , Logger(owner->Logger().WithTag("Address: %v", peerAddress)) , PeerAddress_(std::move(peerAddress)) { } diff --git a/yt/yt/core/rpc/server_detail.cpp b/yt/yt/core/rpc/server_detail.cpp index cb8ffc44a9..24a01a79ab 100644 --- a/yt/yt/core/rpc/server_detail.cpp +++ b/yt/yt/core/rpc/server_detail.cpp @@ -134,7 +134,7 @@ void TServiceContextBase::ReplyEpilogue() LoggingEnabled_ && TDispatcher::Get()->ShouldAlertOnMissingRequestInfo()) { - static const auto& Logger = RpcServerLogger; + static constexpr auto& Logger = RpcServerLogger; YT_LOG_ALERT("Missing request info (RequestId: %v, Method: %v.%v)", RequestId_, RequestHeader_->service(), diff --git a/yt/yt/core/ytree/attribute_filter.cpp b/yt/yt/core/ytree/attribute_filter.cpp index e11dc54444..b38c432804 100644 --- a/yt/yt/core/ytree/attribute_filter.cpp +++ b/yt/yt/core/ytree/attribute_filter.cpp @@ -31,7 +31,7 @@ using NYT::FromProto; //////////////////////////////////////////////////////////////////////////////// //! Used only for YT_LOG_ALERT. -static const TLogger Logger("AttributeFilter"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, Logger, "AttributeFilter"); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/library/backtrace_introspector/introspect.cpp b/yt/yt/library/backtrace_introspector/introspect.cpp index 941dbaed65..9544ac336f 100644 --- a/yt/yt/library/backtrace_introspector/introspect.cpp +++ b/yt/yt/library/backtrace_introspector/introspect.cpp @@ -32,7 +32,7 @@ using namespace NBacktrace; //////////////////////////////////////////////////////////////////////////////// -static const auto& Logger = BacktraceIntrospectorLogger; +static constexpr auto& Logger = BacktraceIntrospectorLogger; //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/library/backtrace_introspector/introspect_linux.cpp b/yt/yt/library/backtrace_introspector/introspect_linux.cpp index 2bee8c0bd3..f2fdf1e8c2 100644 --- a/yt/yt/library/backtrace_introspector/introspect_linux.cpp +++ b/yt/yt/library/backtrace_introspector/introspect_linux.cpp @@ -34,7 +34,7 @@ using namespace NBacktrace; //////////////////////////////////////////////////////////////////////////////// -static const auto& Logger = BacktraceIntrospectorLogger; +static constexpr auto& Logger = BacktraceIntrospectorLogger; //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/library/backtrace_introspector/private.h b/yt/yt/library/backtrace_introspector/private.h index 59f25e6023..3f99c307a5 100644 --- a/yt/yt/library/backtrace_introspector/private.h +++ b/yt/yt/library/backtrace_introspector/private.h @@ -8,7 +8,7 @@ namespace NYT::NBacktraceIntrospector { //////////////////////////////////////////////////////////////////////////////// -inline const NLogging::TLogger BacktraceIntrospectorLogger("BacktraceIntrospector"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, BacktraceIntrospectorLogger, "BacktraceIntrospector"); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/library/formats/arrow_writer.cpp b/yt/yt/library/formats/arrow_writer.cpp index 6d74d54e1b..15faaa27a7 100644 --- a/yt/yt/library/formats/arrow_writer.cpp +++ b/yt/yt/library/formats/arrow_writer.cpp @@ -29,7 +29,7 @@ namespace NYT::NFormats { using namespace NTableClient; using namespace NComplexTypes; -static const auto& Logger = FormatsLogger; +static constexpr auto& Logger = FormatsLogger; using TBodyWriter = std::function<void(TMutableRef)>; using TBatchColumn = IUnversionedColumnarRowBatch::TColumn; diff --git a/yt/yt/library/monitoring/monitoring_manager.cpp b/yt/yt/library/monitoring/monitoring_manager.cpp index ef642034a4..263443060b 100644 --- a/yt/yt/library/monitoring/monitoring_manager.cpp +++ b/yt/yt/library/monitoring/monitoring_manager.cpp @@ -22,7 +22,7 @@ using namespace NConcurrency; //////////////////////////////////////////////////////////////////////////////// -static const auto& Logger = MonitoringLogger; +static constexpr auto& Logger = MonitoringLogger; static const auto UpdatePeriod = TDuration::Seconds(3); static const auto EmptyRoot = GetEphemeralNodeFactory()->CreateMap(); diff --git a/yt/yt/library/monitoring/private.h b/yt/yt/library/monitoring/private.h index e2bfb31c78..61809bdb68 100644 --- a/yt/yt/library/monitoring/private.h +++ b/yt/yt/library/monitoring/private.h @@ -8,7 +8,7 @@ namespace NYT::NMonitoring { //////////////////////////////////////////////////////////////////////////////// -inline const NLogging::TLogger MonitoringLogger("Monitoring"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, MonitoringLogger, "Monitoring"); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/library/process/pipe.cpp b/yt/yt/library/process/pipe.cpp index c35d82b2c9..6584b75b5d 100644 --- a/yt/yt/library/process/pipe.cpp +++ b/yt/yt/library/process/pipe.cpp @@ -16,7 +16,7 @@ using namespace NNet; //////////////////////////////////////////////////////////////////////////////// -static const auto& Logger = PipesLogger; +static constexpr auto& Logger = PipesLogger; //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/library/process/private.h b/yt/yt/library/process/private.h index 95b2ffb0f5..c185792e37 100644 --- a/yt/yt/library/process/private.h +++ b/yt/yt/library/process/private.h @@ -6,8 +6,8 @@ namespace NYT::NPipes { //////////////////////////////////////////////////////////////////////////////// -inline const NLogging::TLogger PipesLogger("Pipes"); -inline const NLogging::TLogger PtyLogger("Pty"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, PipesLogger, "Pipes"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, PtyLogger, "Pty"); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/library/process/process.cpp b/yt/yt/library/process/process.cpp index c75dcb3f16..7dfe79e2fb 100644 --- a/yt/yt/library/process/process.cpp +++ b/yt/yt/library/process/process.cpp @@ -58,7 +58,7 @@ using namespace NConcurrency; //////////////////////////////////////////////////////////////////////////////// -static inline const NLogging::TLogger Logger("Process"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, Logger, "Process"); static constexpr pid_t InvalidProcessId = -1; @@ -210,7 +210,7 @@ private: TErrorOr<TString> ResolveBinaryPath(const TString& binary) { - auto Logger = NYT::Logger + auto Logger = NYT::Logger() .WithTag("Binary: %v", binary); YT_LOG_DEBUG("Resolving binary path"); diff --git a/yt/yt/library/process/subprocess.cpp b/yt/yt/library/process/subprocess.cpp index 809ad13c49..5efc2eb39b 100644 --- a/yt/yt/library/process/subprocess.cpp +++ b/yt/yt/library/process/subprocess.cpp @@ -21,7 +21,7 @@ using namespace NPipes; const static size_t PipeBlockSize = 64 * 1024; -static const NLogging::TLogger Logger("Subprocess"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, Logger, "Subprocess"); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/library/profiling/solomon/exporter.cpp b/yt/yt/library/profiling/solomon/exporter.cpp index ebb7aee092..f712d64c53 100644 --- a/yt/yt/library/profiling/solomon/exporter.cpp +++ b/yt/yt/library/profiling/solomon/exporter.cpp @@ -617,7 +617,7 @@ void TSolomonExporter::DoHandleShard( { TPromise<TSharedRef> responsePromise = NewPromise<TSharedRef>(); - auto Logger = NProfiling::Logger.WithTag("Shard: %v", name); + auto Logger = NProfiling::Logger().WithTag("Shard: %v", name); try { auto format = NMonitoring::EFormat::JSON; diff --git a/yt/yt/library/profiling/solomon/private.h b/yt/yt/library/profiling/solomon/private.h index 82bb3c6b3b..c0e53ab680 100644 --- a/yt/yt/library/profiling/solomon/private.h +++ b/yt/yt/library/profiling/solomon/private.h @@ -6,7 +6,7 @@ namespace NYT::NProfiling { //////////////////////////////////////////////////////////////////////////////// -inline const NLogging::TLogger SolomonLogger("Solomon"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, SolomonLogger, "Solomon"); inline const int DefaultProducerCollectionBatchSize = 100; diff --git a/yt/yt/library/program/build_attributes.cpp b/yt/yt/library/program/build_attributes.cpp index 38caf57997..12207af4df 100644 --- a/yt/yt/library/program/build_attributes.cpp +++ b/yt/yt/library/program/build_attributes.cpp @@ -12,7 +12,7 @@ namespace NYT { using namespace NYTree; using namespace NYson; -static const NLogging::TLogger Logger("Build"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, Logger, "Build"); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/library/program/private.h b/yt/yt/library/program/private.h index e328f30667..e6e06faf63 100644 --- a/yt/yt/library/program/private.h +++ b/yt/yt/library/program/private.h @@ -8,7 +8,7 @@ namespace NYT { //////////////////////////////////////////////////////////////////////////////// -inline const NLogging::TLogger ProgramLogger("Program"); +YT_DEFINE_GLOBAL(const NLogging::TLogger, ProgramLogger, "Program"); //////////////////////////////////////////////////////////////////////////////// |