logrus-nxlog-hook: github.com/affectv/logrus-nxlog-hook Index | Files

package nxlog

import "github.com/affectv/logrus-nxlog-hook"

Index

Package Files

nxlog_hook.go nxlog_writer.go

type Hook Uses

type Hook struct {
    Level     logrus.Level
    Formatter logrus.Formatter
    // contains filtered or unexported fields
}

Hook to send logs to a service compatible with the NXlog API.

func NewNxlogHook Uses

func NewNxlogHook(protocol string, endpoint string, options interface{}) (*Hook, error)

NewNxlogHook creates a hook to be added to an instance of logrus logger.

func (*Hook) Fire Uses

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

Fire is triggered by a log event. The event might be altered by another hook.

func (*Hook) Levels Uses

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

Levels returns the available logging levels.

type Writer Uses

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

Writer represents a writer to NXLog

func NewWriter Uses

func NewWriter(protocol string, endpoint string, settings interface{}) (*Writer, error)

NewWriter returns a reference to a new writer, with protocol, endpoint and settings populated. It also tries to connect to it and returns nil on success or error otherwise.

func (*Writer) Close Uses

func (w *Writer) Close()

Close will close the current connection if possible.

func (*Writer) Connect Uses

func (w *Writer) Connect() error

Connect with the protocol and endpoint specified in the writer.

func (*Writer) Reconnect Uses

func (w *Writer) Reconnect()

Reconnect will close the connection and open it again.

func (*Writer) Write Uses

func (w *Writer) Write(message []byte, reconnect bool) (int, error)

Write will send a message to the open connection of the writer. In case of error, it will try to reconnect once.

Package nxlog imports 5 packages (graph). Updated 2019-01-30. Refresh now. Tools for package owners.