http

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: AGPL-3.0 Imports: 10 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 WithTargetName

func WithTargetName(name string) Option

WithTargetName target name

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) Endpoint

func (h *Target) Endpoint() string

Endpoint returns the backend endpoint

func (*Target) Send

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

Send log message 'e' to http target.

func (*Target) String

func (h *Target) String() string

func (*Target) Validate

func (h *Target) Validate() error

Validate validate the http target

Jump to

Keyboard shortcuts

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