Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract logger to components #997

Merged
merged 1 commit into from
Apr 9, 2020
Merged

Conversation

delner
Copy link
Contributor

@delner delner commented Apr 8, 2020

Based on #996 this pull request extracts the logger and debug mode to Datadog::Configuration::Components, consequently changing the old interface for configuring and using logging:

  • Datadog::Logger.log --> Datadog.log
  • Datadog::Logger.debug_logging --> Datadog.configuration.diagnostics.debug

And instead of:

logger = ::Logger(STDOUT)

Datadog.configure { |c| c.tracer log: logger, debug: true) }
# OR
Datadog.Logger.log = logger
Datadog.Logger.debug_logging = true

You configure with:

Datadog.configure do |c|
  c.logger = logger
  c.logger.level = ::Logger::INFO
  c.diagnostics.debug = true # Optionally forces logging to debug
end

Old style is still supported but will be deprecated in favor of this new style.

@delner delner added core Involves Datadog core libraries dev/refactor Involves refactoring existing components labels Apr 8, 2020
@delner delner added this to the 0.35.0 milestone Apr 8, 2020
@delner delner requested review from marcotc, brettlangdon and a team April 8, 2020 21:47
@delner delner self-assigned this Apr 8, 2020
@delner delner force-pushed the refactor/extract_logger_component branch from 8f4a26c to 0ba2d63 Compare April 8, 2020 22:22
lib/ddtrace/buffer.rb Outdated Show resolved Hide resolved
@delner delner force-pushed the refactor/extract_logger_component branch from 0ba2d63 to f4d883a Compare April 9, 2020 19:31
@delner delner force-pushed the refactor/extract_logger_component branch from f4d883a to 2515b5d Compare April 9, 2020 20:34
Copy link
Member

@marcotc marcotc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more giant leap towards better configuration 🥇

@@ -0,0 +1,83 @@
require 'spec_helper'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see this test migrated to RSpec 💯

@delner delner merged commit 7a643d1 into master Apr 9, 2020
@delner delner deleted the refactor/extract_logger_component branch April 9, 2020 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Involves Datadog core libraries dev/refactor Involves refactoring existing components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants