Documentation ¶
Index ¶
- func NewBlacklistKeysFilter(keys ...interface{}) func(*Notice) *Notice
- func SetLogger(l *log.Logger)
- type Error
- type Notice
- type Notifier
- func (n *Notifier) AddFilter(fn func(*Notice) *Notice)
- func (n *Notifier) Close() error
- func (n *Notifier) CloseTimeout(timeout time.Duration) error
- func (n *Notifier) Flush()
- func (n *Notifier) Notice(err interface{}, req *http.Request, depth int) *Notice
- func (n *Notifier) Notify(e interface{}, req *http.Request)
- func (n *Notifier) NotifyOnPanic()
- func (n *Notifier) NotifyRequest(req *RequestInfo) error
- func (n *Notifier) SendNotice(notice *Notice) (string, error)
- func (n *Notifier) SendNoticeAsync(notice *Notice)
- type NotifierOptions
- type RequestInfo
- type StackFrame
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBlacklistKeysFilter ¶
Example ¶
package main import ( "regexp" "github.com/airbrake/gobrake" ) func main() { notifier := gobrake.NewNotifier(1, "key") filter := gobrake.NewBlacklistKeysFilter("password", regexp.MustCompile("(?i)(user)")) notifier.AddFilter(filter) notice := &gobrake.Notice{ Params: map[string]interface{}{ "password": "slds2&LP", "User": "username", "email": "john@example.com", }, } notifier.Notify(notice, nil) }
Output:
Types ¶
type Error ¶
type Error struct { Type string `json:"type"` Message string `json:"message"` Backtrace []StackFrame `json:"backtrace"` }
type Notice ¶
type Notice struct { Id string `json:"-"` // id returned by SendNotice Error error `json:"-"` // error returned by SendNotice Errors []Error `json:"errors"` Context map[string]interface{} `json:"context"` Env map[string]interface{} `json:"environment"` Session map[string]interface{} `json:"session"` Params map[string]interface{} `json:"params"` }
func (*Notice) SetRequest ¶
type Notifier ¶
type Notifier struct {
// contains filtered or unexported fields
}
func NewNotifier ¶
func NewNotifierWithOptions ¶
func NewNotifierWithOptions(opt *NotifierOptions) *Notifier
func (*Notifier) AddFilter ¶
AddFilter adds filter that can change notice or ignore it by returning nil.
func (*Notifier) CloseTimeout ¶
CloseTimeout waits for pending requests to finish and then closes the notifier.
func (*Notifier) Notice ¶
Notice returns Aibrake notice created from error and request. depth determines which call frame to use when constructing backtrace.
func (*Notifier) NotifyOnPanic ¶
func (n *Notifier) NotifyOnPanic()
NotifyOnPanic notifies Airbrake about the panic and should be used with defer statement.
func (*Notifier) NotifyRequest ¶
func (n *Notifier) NotifyRequest(req *RequestInfo) error
NotifyRequest notifies Airbrake about the request.
func (*Notifier) SendNotice ¶
SendNotice sends notice to Airbrake.
func (*Notifier) SendNoticeAsync ¶
SendNoticeAsync is like SendNotice, but sends notice asynchronously. Pending notices can be flushed with Flush.
type NotifierOptions ¶
type NotifierOptions struct { // Airbrake project id. ProjectId int64 // Airbrake project key. ProjectKey string // Airbrake host name. Default is https://airbrake.io. Host string // Environment such as production or development. Environment string // Git revision. Default is SOURCE_VERSION on Heroku. Revision string // List of keys containing sensitive information that must be filtered out. // Default is password, secret. KeysBlacklist []interface{} // http.Client that is used to interact with Airbrake API. HTTPClient *http.Client }
type RequestInfo ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.