logger

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrWriter is the Error generated by problems with the writer
	ErrWriter byte = iota
	// ErrLog is the Error generated by problems with the Log
	ErrLog
	// ErrOther unexpected errors unrelated to logging or writer
	ErrOther
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LogProcessor

type LogProcessor struct {
	*log.Logger

	EntryChan chan []byte
	// contains filtered or unexported fields
}

LogProcessor is a TopicProcessor that intercepts messages on the gossip to create statistics and push the to the monitoring process It creates a new instance of logrus and writes on a io.Writer (preferrably UNIX sockets but any kind of connection will do)

func New

func New(p eventbus.Broker, w io.WriteCloser, formatter log.Formatter) *LogProcessor

New creates a LogProcessor

func (*LogProcessor) Close

func (l *LogProcessor) Close() error

Close the listener and the Writer

func (*LogProcessor) Listen added in v0.2.0

func (l *LogProcessor) Listen()

Listen as specified in the TopicListener interface

func (*LogProcessor) PublishBlockEvent

func (l *LogProcessor) PublishBlockEvent(blk *block.Block)

func (*LogProcessor) ReportError

func (l *LogProcessor) ReportError(bErr byte, err error)

ReportError publishes an error on the MonitorTopic

func (*LogProcessor) Send

func (l *LogProcessor) Send(entry []byte) error

Send specifies the format and the writer for the log

func (*LogProcessor) WithBlock

func (l *LogProcessor) WithBlock(blk *block.Block) *log.Entry

func (*LogProcessor) WithError

func (l *LogProcessor) WithError(err error) *log.Entry

WithError decorates the log with an error info

func (*LogProcessor) WithTime

func (l *LogProcessor) WithTime(fields log.Fields) *log.Entry

WithTime decorates the log with time info

Jump to

Keyboard shortcuts

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