Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions rollrus.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,24 @@ func NewHook(token string, env string, opts ...OptionFunc) *Hook {
return h
}

// NewHookWithCustomRollbarClient creates a hook that is intended for use with your own rollbar.Client
// instance. Uses the default report levels defined in wellKnownErrorFields.
func NewHookWithCustomRollbarClient(client *rollbar.Client, opts ...OptionFunc) *Hook {
h := &Hook{
Client: client,
triggers: defaultTriggerLevels,
ignoredErrors: make([]error, 0),
ignoreErrorFunc: func(error) bool { return false },
ignoreFunc: func(error, map[string]interface{}) bool { return false },
}

for _, o := range opts {
o(h)
}

return h
}

// SetupLogging for use on Heroku. If token is not an empty string a Rollbar
// hook is added with the environment set to env. The log formatter is set to a
// TextFormatter with timestamps disabled.
Expand Down