buflog

package
v0.9.0-beta Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2021 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufLog

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

BufLog implements a simple log buffer that can be supplied to a std log instance. It stores logs up to N lines.

func New

func New(maxLines int) *BufLog

New returns a new log buffer that stores up to maxLines lines.

func (*BufLog) Lines

func (bu *BufLog) Lines() []string

Lines returns the log lines.

func (*BufLog) Write

func (bu *BufLog) Write(b []byte) (n int, err error)

Write writes a log item to the buffer maintaining maxLines capacity using LIFO.

Jump to

Keyboard shortcuts

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