class Sentry::Rails::LogSubscriber

def log_structured_event(message:, level: :info, attributes: {}, origin: ORIGIN)

Parameters:
  • origin (String) -- The origin of the log event
  • attributes (Hash) -- Additional structured attributes to include
  • level (Symbol) -- The log level (:trace, :debug, :info, :warn, :error, :fatal)
  • message (String) -- The log message
def log_structured_event(message:, level: :info, attributes: {}, origin: ORIGIN)
  Sentry.logger.public_send(level, message, **attributes, origin: origin)
rescue => e
  # Silently handle any errors in logging to avoid breaking the application
  Sentry.configuration.sdk_logger.debug("Failed to log structured event: #{e.message}")
end