report

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGcpErrorReportingClient

func NewGcpErrorReportingClient(
	projectID, serviceName string,
) *errorreporting.Client

NewGcpErrorReportingClient returns a new Stackdriver Error Reporting client.

Types

type FakeReportingClient

type FakeReportingClient struct {
	// contains filtered or unexported fields
}

FakeReportingClient is a fake reporting client.

func NewFakeReportingClient

func NewFakeReportingClient() *FakeReportingClient

NewFakeReportingClient creates a new FakeReportingClient that has the reporter initialized to a basic logger to STDERR.

func (*FakeReportingClient) Close

func (c *FakeReportingClient) Close() error

Close is a NOP (there is nothing to close).

func (*FakeReportingClient) GetReportBuffer

func (c *FakeReportingClient) GetReportBuffer() bytes.Buffer

GetReportBuffer retrieves the reportBuffer.

func (*FakeReportingClient) Report

func (c *FakeReportingClient) Report(
	e errorreporting.Entry,
)

Report simply prints the entry to STDERR. Nothing goes over the network!

type Reporter

type Reporter interface {
	Report(errorreporting.Entry)
}

Reporter requires a single method, called Report(), which corresponds to calling Stackdriver Error Reporting for the real implementation.

type ReportingFacility

type ReportingFacility interface {
	Reporter
	io.Closer
}

ReportingFacility has a Reporter and Closer. Unlike LoggingFacility, there is no need to have a struct type because the same thing is used to call Report() and Close() on. This is because the real implementation calls both Report() and Close() methods on the same errorreporting.Client type (and so, the fake implementation follows suit and does the same). As such, there is no need to have a wrapper struct around the two (separate) interfaces, and ReportingFacility is just a plain interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL