Method: Honeybadger::Agent#add_breadcrumb

Defined in:
lib/honeybadger/agent.rb

#add_breadcrumb(message, metadata: {}, category: "custom") ⇒ Object

Appends a breadcrumb to the trace. Use this when you want to add some custom data to your breadcrumb trace in effort to help debugging. If a notice is reported to Honeybadger, all breadcrumbs within the execution path will be appended to the notice. You will be able to view the breadcrumb trace in the Honeybadger interface to see what events led up to the notice.

Examples:

Honeybadger.add_breadcrumb("Email Sent", metadata: { user: user.id, message: message })

Parameters:

  • message (String)

    The message you want to send with the breadcrumb

  • params (Hash)

    extra options for breadcrumb building

Returns:

  • self

[View source]

324
325
326
327
328
329
330
331
332
333
334
# File 'lib/honeybadger/agent.rb', line 324

def add_breadcrumb(message, metadata: {}, category: "custom")
  params = Util::Sanitizer.new(max_depth: 2).sanitize({
    category: category,
    message: message,
    metadata: 
  })

  breadcrumbs.add!(Breadcrumbs::Breadcrumb.new(**params))

  self
end