Customizing error reports

Filtering report metadata

The OnBeforeNotify configuration option allows for removing metadata from the report payload by making available the raw data which will be sent.

    func(event *bugsnag.Event, config *bugsnag.Configuration) error {

    // Remove a potentially sensitive parameter from the raw payload data
    delete(event.RawData, "credit_card_param")
    return nil

Skipping lines in a stacktrace

If you have your own logging wrapper all of your errors will appear to originate from inside it. You can avoid this problem by constructing an error with a stacktrace manually, and then passing that to Bugsnag.notify:

import (

func LogError(e error) {
    // 1 removes one line of stacktrace, so the caller of LogError
    // will be at the top.
    e = errors.New(e, 1)