|
407 | 407 | subject(:logger) { test_class.logger } |
408 | 408 |
|
409 | 409 | it { is_expected.to be_a_kind_of(Datadog::Core::Logger) } |
| 410 | + it { expect(logger.level).to be ::Logger::INFO } |
410 | 411 |
|
411 | | - it 'has the default log level' do |
412 | | - # If configuration is not initialized, and components neither, we create a temporary logger with debug level |
413 | | - # In order to test that the default log level is INFO, we need to ensure that configuration is initialized. |
414 | | - test_class.configuration |
415 | | - |
416 | | - expect(logger.level).to be default_log_level |
417 | | - end |
418 | | - |
419 | | - context 'when components are not initialized but configuration is' do |
420 | | - before do |
421 | | - test_class.configuration |
422 | | - end |
423 | | - |
424 | | - it 'calls logger_without_components' do |
425 | | - expect(test_class).to receive(:logger_without_components) |
426 | | - |
427 | | - logger |
428 | | - end |
429 | | - |
430 | | - it 'does not call logger_without_configuration' do |
431 | | - expect(test_class).to_not receive(:logger_without_configuration) |
432 | | - |
433 | | - logger |
434 | | - end |
435 | | - |
| 412 | + context 'when components are not initialized' do |
436 | 413 | it 'does not cause them to be initialized' do |
437 | 414 | logger |
438 | 415 |
|
439 | 416 | expect(test_class.send(:components?)).to be false |
440 | 417 | end |
441 | 418 | end |
442 | 419 |
|
443 | | - context 'when configuration is not initialized' do |
444 | | - it { expect(logger.level).to be ::Logger::DEBUG } |
445 | | - |
446 | | - it 'calls logger_without_configuration' do |
447 | | - expect(test_class).to receive(:logger_without_configuration) |
448 | | - |
449 | | - logger |
450 | | - end |
451 | | - |
452 | | - it 'does not call configuration' do |
453 | | - expect(test_class).to_not receive(:configuration) |
454 | | - |
455 | | - logger |
456 | | - end |
457 | | - |
458 | | - it 'returns a logger without configuration' do |
459 | | - logger |
460 | | - |
461 | | - expect(logger).to be_a_kind_of(Datadog::Core::Logger) |
462 | | - end |
463 | | - end |
464 | | - |
465 | 420 | context 'when components are being replaced' do |
466 | 421 | before do |
467 | 422 | test_class.configure {} |
|
485 | 440 | end |
486 | 441 | end |
487 | 442 |
|
| 443 | + describe '#logger_without_configuration' do |
| 444 | + subject(:logger_without_configuration) { test_class.send(:logger_without_configuration) } |
| 445 | + context 'when configuration is not initialized and DD_TRACE_DEBUG is not set' do |
| 446 | + it { expect(logger_without_configuration.level).to be ::Logger::INFO } |
| 447 | + end |
| 448 | + |
| 449 | + context 'when configuration is not initialized and DD_TRACE_DEBUG is set' do |
| 450 | + around do |example| |
| 451 | + ClimateControl.modify('DD_TRACE_DEBUG' => 'true') do |
| 452 | + example.run |
| 453 | + end |
| 454 | + end |
| 455 | + |
| 456 | + it { expect(logger_without_configuration.level).to be ::Logger::DEBUG } |
| 457 | + end |
| 458 | + end |
| 459 | + |
488 | 460 | describe '#runtime_metrics' do |
489 | 461 | subject(:runtime_metrics) { test_class.send(:components).runtime_metrics } |
490 | 462 |
|
|
0 commit comments