Skip to content

Commit 114da05

Browse files
committed
revert logger_without_configuration changes
1 parent 162f6cc commit 114da05

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

lib/datadog/core/configuration.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ def logger
174174

175175
# During stable config initialization, we also have to check for DD_TRACE_DEBUG in local and fleet config.
176176
# We pass the debug source value
177-
def config_init_logger(debug_source_value = DATADOG_ENV[Ext::Diagnostics::ENV_DEBUG_ENABLED])
178-
configuration? ? logger : logger_without_configuration(debug_source_value)
177+
def config_init_logger
178+
configuration? ? logger : logger_without_configuration
179179
end
180180

181181
# Gracefully shuts down all components.
@@ -292,17 +292,17 @@ def logger_without_components
292292
end
293293
end
294294

295-
def logger_without_configuration(debug_source_value)
295+
def logger_without_configuration
296296
# There's rare cases where we need to use logger during configuration initialization,
297297
# such as reading stable config. In this case we cannot access configuration.
298298

299299
@temp_config_logger ||= begin
300-
debug_value = debug_source_value&.strip&.downcase
301-
debug = debug_value == 'true' || debug_value == '1'
300+
debug_env_value = DATADOG_ENV[Ext::Diagnostics::ENV_DEBUG_ENABLED]&.strip&.downcase
301+
debug_value = debug_env_value == 'true' || debug_env_value == '1'
302302

303303
logger = Core::Logger.new($stdout)
304304
# We cannot access config and the default level is INFO, so we need to set the level manually
305-
logger.level = debug ? ::Logger::DEBUG : ::Logger::INFO
305+
logger.level = debug_value ? ::Logger::DEBUG : ::Logger::INFO
306306
logger
307307
end
308308
end

sig/datadog/core/configuration.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module Datadog
99

1010
def configuration: () -> untyped # The DSL methods have to be explicitly declared for this to be typed
1111

12-
def config_init_logger: (?String debug_source_value) -> Datadog::Core::Logger
12+
def config_init_logger: () -> Datadog::Core::Logger
1313

1414
def shutdown!: -> void
1515
end

spec/datadog/core/configuration_spec.rb

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -448,25 +448,20 @@
448448
end
449449

450450
describe '#logger_without_configuration' do
451-
subject(:logger_without_configuration) { test_class.send(:logger_without_configuration, debug_source_value) }
452-
453-
context 'when configuration is not initialized and debug_source_value is not set' do
454-
let(:debug_source_value) { nil }
455-
451+
subject(:logger_without_configuration) { test_class.send(:logger_without_configuration) }
452+
context 'when configuration is not initialized and DD_TRACE_DEBUG is not set' do
456453
it { expect(logger_without_configuration.level).to be ::Logger::INFO }
457454
end
458455

459-
context 'when configuration is not initialized and debug_source_value is set to true' do
460-
let(:debug_source_value) { 'true' }
456+
context 'when configuration is not initialized and DD_TRACE_DEBUG is set' do
457+
around do |example|
458+
ClimateControl.modify('DD_TRACE_DEBUG' => 'true') do
459+
example.run
460+
end
461+
end
461462

462463
it { expect(logger_without_configuration.level).to be ::Logger::DEBUG }
463464
end
464-
465-
context 'when configuration is not initialized and debug_source_value is set to false' do
466-
let(:debug_source_value) { 'false' }
467-
468-
it { expect(logger_without_configuration.level).to be ::Logger::INFO }
469-
end
470465
end
471466

472467
describe '#runtime_metrics' do

0 commit comments

Comments
 (0)