http

package
v0.0.0-...-2ecbb9b Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Target)

Option is a function type that accepts a pointer Target

func WithAuthToken

func WithAuthToken(authToken string) Option

WithAuthToken adds a new authorization header to be sent to target.

func WithEndpoint

func WithEndpoint(endpoint string) Option

WithEndpoint adds a new endpoint

func WithLogKind

func WithLogKind(logKind string) Option

WithLogKind adds a log type for this target

func WithTransport

func WithTransport(transport *http.Transport) Option

WithTransport adds a custom transport with custom timeouts and tuning.

func WithUserAgent

func WithUserAgent(userAgent string) Option

WithUserAgent adds a custom user-agent sent to the target.

type Target

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

Target implements logger.Target and sends the json format of a log entry to the configured http endpoint. An internal buffer of logs is maintained but when the buffer is full, new logs are just ignored and an error is returned to the caller.

func New

func New(opts ...Option) *Target

New initializes a new logger target which sends log over http to the specified endpoint

func (*Target) Send

func (h *Target) Send(entry interface{}, errKind string) error

Send log message 'e' to http target.

Jump to

Keyboard shortcuts

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