logruzio

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2021 License: NCSA, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hook

type Hook struct {
	sync.Mutex
	Conn    net.Conn
	Context logrus.Fields

	Formatter logrus.Formatter
	// contains filtered or unexported fields
}

Hook represents a Logrus Logzio hook

func New

func New(token string, appName string, ttl time.Duration, ctx logrus.Fields) (*Hook, error)

New creates a default Logzio hook. What it does is taking `token` and `appName` and attaching them to the log data. In addition, it sets a connection to the Logzio's Logstash endpoint. If the connection fails, it returns an error.

To set more advanced configurations, initialize the hook in the following way:

hook := &Hook{HookOpts{
		Conn: myConn,
		Context: logrus.Fields{...},
		Formatter: myFormatter{}
}

func (*Hook) Fire

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

Fire writes `entry` to Logzio

func (*Hook) Levels

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

Levels returns logging levels

type SimpleFormatter

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

SimpleFormatter represents a simple JSON formatter

func (*SimpleFormatter) Format

func (f *SimpleFormatter) Format(entry *logrus.Entry) ([]byte, error)

Format formats the log entry to a JSON format Logstash understands

Jump to

Keyboard shortcuts

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