log

package
v0.0.0-...-a5c446f Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 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 EventSink

type EventSink interface {
	Receive(keyvals ...interface{}) error
}

EventSink interface

type HTTPEvent

type HTTPEvent struct {
	Timestamp time.Time              `json:"timestamp"`
	Message   map[string]interface{} `json:"message"`
}

HTTPEvent represents an arbitrary key-value event

type HTTPEventSink

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

HTTPEventSink pushes arbitrary key-value events to an external location

func NewHTTPSink

func NewHTTPSink(host string, path string, method string) HTTPEventSink

NewHTTPSink initializes and returns an HTTPEventSink

func (*HTTPEventSink) Receive

func (httpsink *HTTPEventSink) Receive(keyvals ...interface{}) error

Receive consumes an arbitrary set of keys and values (k1,v1,k2,v2,...), constructs an HTTPEvent from them, and sends them to the configured http endpoint using the configured method

type LocalEventSink

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

LocalEventSink - an implementation of EventSink that simply logs events to os.Stderr.

func NewLocalEventSink

func NewLocalEventSink() *LocalEventSink

New Logs local sink.

func (*LocalEventSink) Receive

func (localSink *LocalEventSink) Receive(keyvals ...interface{}) error

Receive Log events.

type Logger

type Logger interface {
	Log(keyvals ...interface{}) error
	Event(keyvals ...interface{}) error
}

Logger interface, supports log messages and "events" where an event is an object that should get received by the configured EventSinks

func NewLogger

func NewLogger(wrapped log.Logger, sinks []EventSink) Logger

NewLogger sets up and returns a Logger

Jump to

Keyboard shortcuts

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