sentry-ruby icon indicating copy to clipboard operation
sentry-ruby copied to clipboard

implement stdlib logger support

Open Eazybright opened this issue 6 months ago • 0 comments

Description

Describe your changes: This is a fun way of adding integration for stdlib Logger so that any usage of any logger instance would result in sending logs to Sentry too. issue

Sample Config

require "sentry-ruby"

# Initialize Sentry with experimental logging feature enabled
Sentry.init do |config|
  config.dsn = "YOUR_SENTRY_DSN"
  config.environment = "development"

  # Set this to enable structured logging via Sentry.logger
  config.enable_logs = true

  # set this to send any instance of stdlib logger to sentry
  config.send_stdlib_logs = true
end

logger = Logger.new(STDOUT)
logger.info('send_stdlib_log') { "send_stdlib_log_enable_logs: Testing 789..." }
logger.warn("ruby logger warn  - - 9")

Sample Result on the UI

Screenshot 2025-06-18 at 11 34 29 PM

Eazybright avatar Jun 18 '25 23:06 Eazybright