instance method
debug
Ruby on Rails 8.1.2
Since v8.1.2Signature
debug(name_or_object, payload = nil, caller_depth: 1, **kwargs)
Report an event only when in debug mode. For example:
Rails.event.debug("sql.query", { sql: "SELECT * FROM users" })
Arguments
-
:payload- The event payload when using string/symbol event names. -
:caller_depth- The stack depth to use for source location (default: 1). -
:kwargs- Additional payload data when using string/symbol event names.
Parameters
-
name_or_objectreq -
payloadopt = nil -
caller_depthkey = 1 -
kwargskeyrest
Source
# File activesupport/lib/active_support/event_reporter.rb, line 435
def debug(name_or_object, payload = nil, caller_depth: 1, **kwargs)
if debug_mode?
if block_given?
notify(name_or_object, payload, caller_depth: caller_depth + 1, **kwargs.merge(yield))
else
notify(name_or_object, payload, caller_depth: caller_depth + 1, **kwargs)
end
end
end
Defined in activesupport/lib/active_support/event_reporter.rb line 435
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::EventReporter