juju: github.com/wallyworld/juju/state/logdb Index | Files

package logdb

import "github.com/wallyworld/juju/state/logdb"


Package Files


type BufferedLogger Uses

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 Uses

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 Uses

func (b *BufferedLogger) Flush() error

Flush flushes any buffered log records to the underlying Logger.

func (*BufferedLogger) Log Uses

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 Uses

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.

Package logdb imports 5 packages (graph). Updated 2019-10-03. Refresh now. Tools for package owners.