burrow: github.com/hyperledger/burrow/logging/loggers Index | Files

package loggers

import "github.com/hyperledger/burrow/logging/loggers"

Index

Package Files

burrow_format_logger.go capture_logger.go channel_logger.go file_logger.go filter_logger.go format.go multiple_output_logger.go sort_logger.go stream_logger.go vector_valued_logger.go

Constants

const (
    DefaultOptions opt = iota
    StringifyValues
)
const (
    JSONFormat     = "json"
    LogfmtFormat   = "logfmt"
    TerminalFormat = "terminal"
    DefaultFormat  = TerminalFormat
)
const (
    DefaultLoggingRingBufferCap channels.BufferCap = 100
)

func FilterLogger Uses

func FilterLogger(outputLogger log.Logger, predicate func(keyvals []interface{}) bool) log.Logger

Filter logger allows us to filter lines logged to it before passing on to underlying output logger Creates a logger that removes lines from output when the predicate evaluates true

func NewBurrowFormatLogger Uses

func NewBurrowFormatLogger(logger log.Logger, options ...opt) *burrowFormatLogger

func NewJSONLogger Uses

func NewJSONLogger(writer io.Writer) log.Logger

func NewLogfmtLogger Uses

func NewLogfmtLogger(writer io.Writer) log.Logger

func NewMultipleOutputLogger Uses

func NewMultipleOutputLogger(outputLoggers ...log.Logger) log.Logger

Creates a logger that forks log messages to each of its outputLoggers

func NewStreamLogger Uses

func NewStreamLogger(writer io.Writer, format string) (log.Logger, error)

func NewTemplateLogger Uses

func NewTemplateLogger(writer io.Writer, textTemplate string, recordSeparator []byte) (log.Logger, error)

func NewTerminalLogger Uses

func NewTerminalLogger(writer io.Writer) log.Logger

func SortLogger Uses

func SortLogger(outputLogger log.Logger, keys ...string) log.Logger

Provides a logger that sorts key-values with keys in keys before other key-values

func VectorValuedLogger Uses

func VectorValuedLogger(logger log.Logger) *vectorValuedLogger

type CaptureLogger Uses

type CaptureLogger struct {
    sync.RWMutex
    // contains filtered or unexported fields
}

func NewCaptureLogger Uses

func NewCaptureLogger(outputLogger log.Logger, bufferCap channels.BufferCap, passthrough bool) *CaptureLogger

Capture logger captures output sent to it in a buffer retaining a reference to its output logger (the logger whose input it is capturing). It can optionally pass logs through to the output logger. Because it holds a reference to its output it can also be used to coordinate Flushing of the buffer to the output logger in special circumstances.

func (*CaptureLogger) BufferLogger Uses

func (cl *CaptureLogger) BufferLogger() *ChannelLogger

The BufferLogger where the input into these CaptureLogger is stored in a ring buffer of log lines.

func (*CaptureLogger) Flush Uses

func (cl *CaptureLogger) Flush() error

Flushes every log line available in the buffer at the time of calling to the OutputLogger and returns. Does not block indefinitely.

Note: will remove log lines from buffer so they will not be produced on any subsequent flush of buffer

func (*CaptureLogger) FlushLogLines Uses

func (cl *CaptureLogger) FlushLogLines() [][]interface{}

Flushes every log line available in the buffer at the time of calling to a slice and returns it. Does not block indefinitely.

Note: will remove log lines from buffer so they will not be produced on any subsequent flush of buffer

func (*CaptureLogger) Log Uses

func (cl *CaptureLogger) Log(keyvals ...interface{}) error

func (*CaptureLogger) OutputLogger Uses

func (cl *CaptureLogger) OutputLogger() log.Logger

The OutputLogger whose input this CaptureLogger is capturing

func (*CaptureLogger) Passthrough Uses

func (cl *CaptureLogger) Passthrough() bool

Gets whether the CaptureLogger is forwarding log lines sent to through to its OutputLogger. Concurrently Safe.

func (*CaptureLogger) SetPassthrough Uses

func (cl *CaptureLogger) SetPassthrough(passthrough bool)

Sets whether the CaptureLogger is forwarding log lines sent to it through to its output logger. Concurrently safe.

type ChannelLogger Uses

type ChannelLogger struct {
    sync.RWMutex
    // contains filtered or unexported fields
}

func NewChannelLogger Uses

func NewChannelLogger(loggingRingBufferCap channels.BufferCap) *ChannelLogger

Creates a Logger that uses a uses a non-blocking ring buffered channel. This logger provides a common abstraction for both a buffered, flushable logging cache. And a non-blocking conduit to transmit logs via DrainForever (or NonBlockingLogger).

func NonBlockingLogger Uses

func NonBlockingLogger(outputLogger log.Logger) (*ChannelLogger, channels.Channel)

Returns a Logger that wraps the outputLogger passed and does not block on calls to Log and a channel of any errors from the underlying logger

func (*ChannelLogger) BufferCap Uses

func (cl *ChannelLogger) BufferCap() channels.BufferCap

Get the cap off the internal ring buffer

func (*ChannelLogger) BufferLength Uses

func (cl *ChannelLogger) BufferLength() int

Get the current occupancy level of the ring buffer

func (*ChannelLogger) DrainForever Uses

func (cl *ChannelLogger) DrainForever(logger log.Logger, errCh channels.Channel)

Enters an infinite loop that will drain any log lines from the passed logger. You may pass in a channel

Exits if the channel is closed.

func (*ChannelLogger) Flush Uses

func (cl *ChannelLogger) Flush(logger log.Logger) error

Drains everything that is available at the time of calling

func (*ChannelLogger) FlushLogLines Uses

func (cl *ChannelLogger) FlushLogLines() [][]interface{}

Drains the next contiguous segment of loglines up to the buffer cap waiting for at least one line

func (*ChannelLogger) Log Uses

func (cl *ChannelLogger) Log(keyvals ...interface{}) error

func (*ChannelLogger) ReadLogLine Uses

func (cl *ChannelLogger) ReadLogLine() []interface{}

Tries to read a log line from the channel buffer or returns nil if none is immediately available

func (*ChannelLogger) Reset Uses

func (cl *ChannelLogger) Reset()

Close the existing channel halting goroutines that are draining the channel and create a new channel to buffer into. Should not cause any log lines arriving concurrently to be lost, but any that have not been drained from old channel may be.

func (*ChannelLogger) WaitReadLogLine Uses

func (cl *ChannelLogger) WaitReadLogLine() []interface{}

Read a log line by waiting until one is available and returning it

type FileLogger Uses

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

func NewFileLogger Uses

func NewFileLogger(path string, formatName string) (*FileLogger, error)

func (*FileLogger) Log Uses

func (fl *FileLogger) Log(keyvals ...interface{}) error

func (*FileLogger) Reload Uses

func (fl *FileLogger) Reload() error

type FileTemplateParams Uses

type FileTemplateParams struct {
    Date time.Time
}

func NewFileTemplateParams Uses

func NewFileTemplateParams() *FileTemplateParams

func (*FileTemplateParams) Timestamp Uses

func (ftp *FileTemplateParams) Timestamp() string

type MultipleOutputLogger Uses

type MultipleOutputLogger []log.Logger

This represents an 'AND' type logger. When logged to it will log to each of the loggers in the slice.

func (MultipleOutputLogger) Log Uses

func (mol MultipleOutputLogger) Log(keyvals ...interface{}) error

type Syncable Uses

type Syncable interface {
    Sync() error
}

Package loggers imports 16 packages (graph) and is imported by 36 packages. Updated 2020-04-23. Refresh now. Tools for package owners.