diff options
author | nadya02 <[email protected]> | 2024-05-22 15:47:35 +0300 |
---|---|---|
committer | nadya02 <[email protected]> | 2024-05-22 16:03:37 +0300 |
commit | 3ca52abbf1a2f85ef2ee907a12e293549dc36aad (patch) | |
tree | 3ff5de16d341a7123154d52dd422d36f3ff2e67c | |
parent | 1f0614780d5f4587feaee32137b862e4dc00b87f (diff) |
Apply to global loggers in yt/yt
2099bd8ce11fc2c9e0566ebafbb9fddf4dad5141
59 files changed, 74 insertions, 75 deletions
diff --git a/yt/yt/client/api/client.cpp b/yt/yt/client/api/client.cpp index be231d8ebf0..7c5e3beb079 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 1e334e7f7a2..b75702a14dd 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 60a8f6a4fa9..4a4e6567fe8 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 37d17eacbf4..176b6f5294d 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 f2ec4bb2e36..9e87f1ccaeb 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 78011d27682..4c2eae9aa59 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 a5819f423a7..d451b755b83 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 c36c6724a1d..65701a56dbe 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 8830264345d..f3a39fbfdf5 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 c870df7f1a7..043a28aa772 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 9371be5f031..d3377c0806a 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 d7fa243b118..8c8440e58b7 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 ef32e71b0ff..6d98deb970d 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 d727a6874f3..782e923abeb 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 32bc9bfdbe9..a915ee5a982 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 6762c79ff26..1e028e828d8 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 cb258a5cfda..0ac2a234719 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 8388b6a302d..84b2a1d6ec9 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 162e8bd2594..a34f8bc307a 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 1333e1c7b7b..656972c76b6 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 e127c5f283e..d02774cd1fa 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 9b88a00d1e4..6ff1c5661f4 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 4b7a197d297..4c82127a377 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 736361c8784..41917b732d9 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 34aefde9db0..0d215415fef 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 92953c792d2..e2a7f67d443 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 6428d87e4e9..a4612c0df13 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 24c8359ee41..49fe0b5acc9 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 39ac63f6056..00def063ee9 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 7ae5f96c52f..3971b897a16 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 aca2725c06d..d3ca4183407 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 5646e3360ea..41ee845af7f 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 ce9a3139517..f87e4140cf4 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 8144fb7cedf..70f85c05499 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 4f7179823bc..16b14236157 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 d94293fd185..89d9b50d932 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 7c468c16b76..fe9c92b1178 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 12a0cf482bb..81a2a4b1d71 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 20e97165a45..8092aaa8509 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 2518ad16994..b351396aae8 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 d03c4165758..3a1913eaa28 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 ba47fba03d7..280bda4c185 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 92a33a24262..67b5353fe51 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 cb8ffc44a91..24a01a79ab1 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 e11dc544446..b38c4328049 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 941dbaed65f..9544ac336fa 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 2bee8c0bd31..f2fdf1e8c24 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 59f25e60232..3f99c307a55 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 6d74d54e1b6..15faaa27a7b 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 ef642034a4c..263443060be 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 e2bfb31c782..61809bdb68b 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 c35d82b2c91..6584b75b5db 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 95b2ffb0f5f..c185792e37e 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 c75dcb3f162..7dfe79e2fb8 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 809ad13c499..5efc2eb39b0 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 ebb7aee0922..f712d64c53f 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 82bb3c6b3bb..c0e53ab6800 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 38caf579978..12207af4df1 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 e328f306671..e6e06faf634 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"); //////////////////////////////////////////////////////////////////////////////// |