Documentation ¶
Overview ¶
Package rollbar implements Rollbar REST API client.
Index ¶
- Constants
- type Call
- type Client
- type CriticalCall
- func (c *CriticalCall) Custom(custom map[string]interface{}) Call
- func (c *CriticalCall) Do(ctx context.Context) (*api.Response, error)
- func (c *CriticalCall) Person(id, username, email string) Call
- func (c *CriticalCall) Request(req *http.Request) Call
- func (c *CriticalCall) Title(title string) Call
- func (c *CriticalCall) UUID(id string) Call
- type DebugCall
- func (c *DebugCall) Custom(custom map[string]interface{}) Call
- func (c *DebugCall) Do(ctx context.Context) (*api.Response, error)
- func (c *DebugCall) Person(id, username, email string) Call
- func (c *DebugCall) Request(req *http.Request) Call
- func (c *DebugCall) Title(title string) Call
- func (c *DebugCall) UUID(id string) Call
- type ErrorCall
- func (c *ErrorCall) Custom(custom map[string]interface{}) Call
- func (c *ErrorCall) Do(ctx context.Context) (*api.Response, error)
- func (c *ErrorCall) Person(id, username, email string) Call
- func (c *ErrorCall) Request(req *http.Request) Call
- func (c *ErrorCall) Title(title string) Call
- func (c *ErrorCall) UUID(id string) Call
- type InfoCall
- func (c *InfoCall) Custom(custom map[string]interface{}) Call
- func (c *InfoCall) Do(ctx context.Context) (*api.Response, error)
- func (c *InfoCall) Person(id, username, email string) Call
- func (c *InfoCall) Request(req *http.Request) Call
- func (c *InfoCall) Title(title string) Call
- func (c *InfoCall) UUID(id string) Call
- type Level
- type Logger
- type Option
- func WithClient(cl *http.Client) Option
- func WithCodeVersion(version string) Option
- func WithDebug(b bool) Option
- func WithEndpoint(s string) Option
- func WithEnvironment(env string) Option
- func WithLogger(l Logger) Option
- func WithPlatform(platform string) Option
- func WithServerBranch(branch string) Option
- func WithServerHost(hostname string) Option
- func WithServerRoot(root string) Option
- func WithStackSkip(skip int) Option
- type Stack
- type WarnCall
- func (c *WarnCall) Custom(custom map[string]interface{}) Call
- func (c *WarnCall) Do(ctx context.Context) (*api.Response, error)
- func (c *WarnCall) Person(id, username, email string) Call
- func (c *WarnCall) Request(req *http.Request) Call
- func (c *WarnCall) Title(title string) Call
- func (c *WarnCall) UUID(id string) Call
Constants ¶
const ( // Name name of client package. Name = "go-rollbar" // Version version of client package. Version = "0.0.0" // UserAgent name of go-rollbar package user agent. UserAgent = "go-rollbar/" + Version )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Call ¶
type Call interface { Request(*http.Request) Call Person(string, string, string) Call Custom(map[string]interface{}) Call UUID(string) Call Title(string) Call Do(context.Context) (*api.Response, error) }
Call respesents a fluent style call options.
type Client ¶
type Client interface { Debug(error) Call Info(error) Call Error(error) Call Warn(error) Call Critical(error) Call }
Client represents a first Client methods.
type CriticalCall ¶
type CriticalCall struct {
// contains filtered or unexported fields
}
CriticalCall represents a calls the critical level stack trace.
func (*CriticalCall) Custom ¶
func (c *CriticalCall) Custom(custom map[string]interface{}) Call
Custom is any arbitrary metadata you want to send. "custom" itself should be an object.
func (*CriticalCall) Person ¶
func (c *CriticalCall) Person(id, username, email string) Call
Person is the user affected by this event. Will be indexed by ID, username, and email. People are stored in Rollbar keyed by ID. If you send a multiple different usernames/emails for the same ID, the last received values will overwrite earlier ones.
func (*CriticalCall) Request ¶
func (c *CriticalCall) Request(req *http.Request) Call
Request is a data about the request this event occurred in.
func (*CriticalCall) Title ¶
func (c *CriticalCall) Title(title string) Call
Title is an optional text description that is displayed when viewing an item. It must be a string, of length 1-255 characters. You can change the title in this configuration without impacting the fingerprint. The new title will take effect if the item is reactivated after being resolved.
func (*CriticalCall) UUID ¶
func (c *CriticalCall) UUID(id string) Call
UUID a string, up to 36 characters, that uniquely identifies this occurrence. While it can now be any latin1 string, this may change to be a 16 byte field in the future. We recommend using a UUID4 (16 random bytes). The UUID space is unique to each project, and can be used to look up an occurrence later. It is also used to detect duplicate requests. If you send the same UUID in two payloads, the second one will be discarded. While optional, it is recommended that all clients generate and provide this field.
type DebugCall ¶
type DebugCall struct {
// contains filtered or unexported fields
}
DebugCall represents a calls the debug level stack trace.
func (*DebugCall) Custom ¶
Custom is any arbitrary metadata you want to send. "custom" itself should be an object.
func (*DebugCall) Person ¶
Person is the user affected by this event. Will be indexed by ID, username, and email. People are stored in Rollbar keyed by ID. If you send a multiple different usernames/emails for the same ID, the last received values will overwrite earlier ones.
func (*DebugCall) Title ¶
Title is an optional text description that is displayed when viewing an item. It must be a string, of length 1-255 characters. You can change the title in this configuration without impacting the fingerprint. The new title will take effect if the item is reactivated after being resolved.
func (*DebugCall) UUID ¶
UUID a string, up to 36 characters, that uniquely identifies this occurrence. While it can now be any latin1 string, this may change to be a 16 byte field in the future. We recommend using a UUID4 (16 random bytes). The UUID space is unique to each project, and can be used to look up an occurrence later. It is also used to detect duplicate requests. If you send the same UUID in two payloads, the second one will be discarded. While optional, it is recommended that all clients generate and provide this field.
type ErrorCall ¶
type ErrorCall struct {
// contains filtered or unexported fields
}
ErrorCall represents a calls the error level stack trace.
func (*ErrorCall) Custom ¶
Custom is any arbitrary metadata you want to send. "custom" itself should be an object.
func (*ErrorCall) Person ¶
Person is the user affected by this event. Will be indexed by ID, username, and email. People are stored in Rollbar keyed by ID. If you send a multiple different usernames/emails for the same ID, the last received values will overwrite earlier ones.
func (*ErrorCall) Title ¶
Title is an optional text description that is displayed when viewing an item. It must be a string, of length 1-255 characters. You can change the title in this configuration without impacting the fingerprint. The new title will take effect if the item is reactivated after being resolved.
func (*ErrorCall) UUID ¶
UUID a string, up to 36 characters, that uniquely identifies this occurrence. While it can now be any latin1 string, this may change to be a 16 byte field in the future. We recommend using a UUID4 (16 random bytes). The UUID space is unique to each project, and can be used to look up an occurrence later. It is also used to detect duplicate requests. If you send the same UUID in two payloads, the second one will be discarded. While optional, it is recommended that all clients generate and provide this field.
type InfoCall ¶
type InfoCall struct {
// contains filtered or unexported fields
}
InfoCall represents a calls the info level stack trace.
func (*InfoCall) Custom ¶
Custom is any arbitrary metadata you want to send. "custom" itself should be an object.
func (*InfoCall) Person ¶
Person is the user affected by this event. Will be indexed by ID, username, and email. People are stored in Rollbar keyed by ID. If you send a multiple different usernames/emails for the same ID, the last received values will overwrite earlier ones.
func (*InfoCall) Title ¶
Title is an optional text description that is displayed when viewing an item. It must be a string, of length 1-255 characters. You can change the title in this configuration without impacting the fingerprint. The new title will take effect if the item is reactivated after being resolved.
func (*InfoCall) UUID ¶
UUID a string, up to 36 characters, that uniquely identifies this occurrence. While it can now be any latin1 string, this may change to be a 16 byte field in the future. We recommend using a UUID4 (16 random bytes). The UUID space is unique to each project, and can be used to look up an occurrence later. It is also used to detect duplicate requests. If you send the same UUID in two payloads, the second one will be discarded. While optional, it is recommended that all clients generate and provide this field.
type Level ¶
type Level string
Level level of stack trace.
const ( // DebugLevel logs are typically voluminous, and are usually disabled in production. DebugLevel Level = "debug" // InfoLevel is the default logging priority. InfoLevel Level = "info" // WarnLevel logs are more important than Info, but don't need individual human review. WarnLevel Level = "warning" // ErrorLevel logs are high-priority. If an application is running smoothly, it shouldn't generate any error-level logs. ErrorLevel Level = "error" // CriticalLevel logs are particularly important errors. In development the logger panics after writing the message. CriticalLevel Level = "critical" )
type Logger ¶
type Logger interface { Debugf(context.Context, string, ...interface{}) Infof(context.Context, string, ...interface{}) }
Logger is an interface for logging/tracing the client's execution.
In particular, `Debug` will only be called if `WithDebug` is provided to the constructor.
type Option ¶
type Option func(*httpClient)
Option defines an interface of optional parameters to the `rollbar.New` constructor.
func WithClient ¶
WithClient allows you to specify an net/http.Client object to use to communicate with the Rollbar endpoints.
For example, if you need to use this in Google App Engine, you can pass it the result of `urlfetch.Client`.
func WithCodeVersion ¶
WithCodeVersion is a string, up to 40 characters, describing the version of the application code
Rollbar understands these formats:
- semantic version (i.e. "2.1.12")
- integer (i.e. "45")
- git SHA (i.e. "3da541559918a808c2402bba5012f6c60b27661c")
func WithDebug ¶
WithDebug specifies that we want to run in debugging mode. You can set this value manually to override any existing global defaults.
If one is not specified, the default value is false, or the value specified in ROLLBAR_DEBUG environment variable.
func WithEndpoint ¶
WithEndpoint allows you to specify an alternate API endpoint. The default is DefaultEndpoint.
func WithEnvironment ¶
WithEnvironment name of the environment in which this occurrence was seen.
A string up to 255 characters. For best results, use "production" or "prod" for your production environment. You don't need to configure anything in the Rollbar UI for new environment names; we'll detect them automatically.
func WithLogger ¶
WithLogger specifies the logger object to be used. If not specified and `WithDebug` is enabled, then a default logger which writes to os.Stderr.
func WithPlatform ¶
WithPlatform name of platform on which this occurred.
Meaningful platform names:
"browser", "android", "ios", "flash", "client", "heroku", "google-app-engine"
If this is a client-side event, be sure to specify the platform and use a post_client_item access token.
func WithServerBranch ¶
WithServerBranch name of the checked-out source control branch. Defaults to "master".
func WithServerHost ¶
WithServerHost is the server hostname. Will be indexed.
func WithServerRoot ¶
WithServerRoot is the path to the application code root. Not including the final slash. Used to collapse non-project code when displaying tracebacks.
type Stack ¶
Stack represents a api.Frame slice.
func CreateStack ¶
CreateStack creates the Stack data except before skip callers.
func CreateStackFromCaller ¶
CreateStackFromCaller creates the Stack data from callers.
func (Stack) Fingerprint ¶
Fingerprint create a fingerprint that uniqely identify a given message. We use the full callstack, including file names. That ensure that there are no false duplicates but also means that after changing the code (adding/removing lines), the fingerprints will change. It's a trade-off.
type WarnCall ¶
type WarnCall struct {
// contains filtered or unexported fields
}
WarnCall represents a calls the warning level stack trace.
func (*WarnCall) Custom ¶
Custom is any arbitrary metadata you want to send. "custom" itself should be an object.
func (*WarnCall) Person ¶
Person is the user affected by this event. Will be indexed by ID, username, and email. People are stored in Rollbar keyed by ID. If you send a multiple different usernames/emails for the same ID, the last received values will overwrite earlier ones.
func (*WarnCall) Title ¶
Title is an optional text description that is displayed when viewing an item. It must be a string, of length 1-255 characters. You can change the title in this configuration without impacting the fingerprint. The new title will take effect if the item is reactivated after being resolved.
func (*WarnCall) UUID ¶
UUID a string, up to 36 characters, that uniquely identifies this occurrence. While it can now be any latin1 string, this may change to be a 16 byte field in the future. We recommend using a UUID4 (16 random bytes). The UUID space is unique to each project, and can be used to look up an occurrence later. It is also used to detect duplicate requests. If you send the same UUID in two payloads, the second one will be discarded. While optional, it is recommended that all clients generate and provide this field.