Documentation ¶
Overview ¶
Package errorreporting is a Google Stackdriver Error Reporting library.
This package is still experimental and subject to change.
See https://cloud.google.com/error-reporting/ for more information.
To initialize a client, use the NewClient function.
import er "cloud.google.com/go/errorreporting" ... errorsClient, err = er.NewClient(ctx, projectID, er.Config{ ServiceName: "myservice", ServiceVersion: "v1.0", })
With a client, you can then report errors:
if err != nil { errorsClient.Report(ctx, er.Entry{Error: err}) }
If you try to write an error report with a nil client, or if the client fails to write the report to the server, the error report is logged using log.Println.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a Google Cloud Error Reporting client.
func NewClient ¶
func NewClient(ctx context.Context, projectID string, cfg Config, opts ...option.ClientOption) (*Client, error)
NewClient returns a new error reporting client. Generally you will want to create a client on program initialization and use it through the lifetime of the process.
func (*Client) Close ¶
Close closes any resources held by the client. Close should be called when the client is no longer needed. It need not be called at program exit.
func (*Client) Flush ¶
func (c *Client) Flush()
Flush blocks until all currently buffered error reports are sent.
If any errors occurred since the last call to Flush, or the creation of the client if this is the first call, then Flush report the error via the (*Client).OnError handler.
type Config ¶
type Config struct { // ServiceName identifies the running program and is included in the error reports. // Optional. ServiceName string // ServiceVersion identifies the version of the running program and is // included in the error reports. // Optional. ServiceVersion string // OnError is the function to call if any background // tasks errored. By default, errors are logged. OnError func(err error) }
Config is additional configuration for Client.
Directories ¶
Path | Synopsis |
---|---|
Package errorreporting is an experimental, auto-generated package for the Stackdriver Error Reporting API.
|
Package errorreporting is an experimental, auto-generated package for the Stackdriver Error Reporting API. |