logdb

package
v0.0.0-...-9ec3720 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: AGPL-3.0 Imports: 5 Imported by: 0

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.

Jump to

Keyboard shortcuts

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