Breadcrumbs
Breadcrumbs are a useful debugging tool that give you the ability to record
contextual data as an event called a breadcrumb
. When your Project reports an
Error (Notice), we send along the breadcrumbs recorded during the execution
(request, job, task, etc...).
Context is another way to store extra data to help with debugging. Context is still a great way to attach global data to an error, however, there are scenarios where Breadcrumbs might be a better choice:
- You want to record metadata that contains duplicate keys
- You want to group related data
- You care about when an event happened in relation to an error
Honeybadger.add_breadcrumb/2
appends a breadcrumb to the notice. 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.
Honeybadger.add_breadcrumb("Email sent", metadata: %{
user: user.id,
message: message
})