logbuffer

package
v0.0.0-...-8f85c39 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RotatingBuffer

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

RotatingLogBuffer splits incoming logs based on the write number of lines are limited to a specified number, then cuts off the oldest entry

Example:

limit = 3
buf[0] = "hello"
buf[1] = "world"
buf[2] = "!"

When another is written:

limit = 3
buf[0] = "Lorum"
buf[1] = "hello"
buf[2] = "world"

func NewRotatingBuffer

func NewRotatingBuffer(limit int) *RotatingBuffer

NewRotatingBuffer initalized with limit

func (*RotatingBuffer) String

func (rb *RotatingBuffer) String() string

String returns all the currently stored byte slices concatentated together into a string.

func (*RotatingBuffer) Write

func (rb *RotatingBuffer) Write(b []byte) (int, error)

Write b to our current buffer. Will never return anything other than len(b) and nil.

Jump to

Keyboard shortcuts

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