Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferedLogger

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

BufferedLogger wraps a Logger, providing a buffer that accumulates log messages, flushing them to the underlying logger when enough messages have been accumulated.

func NewBufferedLogger

func NewBufferedLogger(
	l Logger,
	bufferSize int,
	flushInterval time.Duration,
	clock clock.Clock,
) *BufferedLogger

NewBufferedLogger returns a new BufferedLogger, wrapping the given Logger with a buffer of the specified size and flush interval.

func (*BufferedLogger) Flush

func (b *BufferedLogger) Flush() error

Flush flushes any buffered log records to the underlying Logger.

func (*BufferedLogger) Log

func (b *BufferedLogger) Log(in []state.LogRecord) error

Log is part of the Logger interface.

BufferedLogger's Log implementation will buffer log records up to the specified capacity and duration; after either of which is exceeded, the records will be flushed to the underlying logger.

type Logger

type Logger interface {
	// Log writes the given log records to the logger's storage.
	Log([]state.LogRecord) error
}

Logger provides an interface for writing log records.

Source Files