logrus

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hook

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

Hook implements a logrus.Hook used for shipping logs to Axiom.

func New

func New(baseURL, accessToken, datasetName string, options ...Option) (*Hook, error)

New creates a new Hook configured to talk to the specified Axiom deployment and authenticating with the given access token. An ingest token is sufficient enough. The logs will be ingested into the specified dataset. Additional options can be supplied to configure the Hook. A Hook needs to be closed properly to make sure all logs are sent by calling Close().

func NewCloud

func NewCloud(accessToken, orgID, datasetName string, options ...Option) (*Hook, error)

NewCloud is like New() but configures the Hook to talk to Axiom Cloud.

func NewWithClient

func NewWithClient(client *axiom.Client, datasetName string, options ...Option) (*Hook, error)

NewWithClient behaves like New() but utilizes an already configured axiom.Client to talk to a deployment.

func (*Hook) Close

func (h *Hook) Close()

Close the hook and make sure all events are flushed. This should be registered with `logrus.RegisterExitHandler(h.Close)`. Closing the hook renders it unusable for further use.

func (*Hook) Fire

func (h *Hook) Fire(entry *logrus.Entry) error

Fire implements logrus.Hook.

func (*Hook) Levels

func (h *Hook) Levels() []logrus.Level

Levels implements logrus.Hook.

func (*Hook) Options

func (h *Hook) Options(options ...Option) error

Options applies Options to the Hook.

type Option

type Option func(*Hook) error

An Option modifies the behaviour of the Axiom hook.

func IngestOptions

func IngestOptions(opts axiom.IngestOptions) Option

IngestOptions specifies the ingestion options to use for ingesting the logs.

func Levels

func Levels(levels ...logrus.Level) Option

Levels sets the logrus levels that the Axiom hook will create log entries for.

Jump to

Keyboard shortcuts

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