logbuf

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: Apache-2.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 LogBuffer

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

Lets play a fast and loose with our locking... There isn't a lot of contention for writing and reading is pretty light too.

func NewLogBuffer

func NewLogBuffer(capacity int) *LogBuffer

func (*LogBuffer) GetOffset

func (lb *LogBuffer) GetOffset() int64

func (*LogBuffer) Length

func (lb *LogBuffer) Length() int

func (*LogBuffer) Read

func (lb *LogBuffer) Read(nn int) []LogEntry

func (*LogBuffer) ReadSince

func (lb *LogBuffer) ReadSince(i int64) ([]LogEntry, int64)

Useful for following logs via a polling strategy Polling is easier to implement than an event system because we don't need to worry about creating a pumper to fan out entries

func (*LogBuffer) Write

func (lb *LogBuffer) Write(source LogSource, line string, timestamp *string)

type LogEntry

type LogEntry struct {
	Timestamp string
	Source    LogSource
	Line      string
}

func (*LogEntry) Format

func (le *LogEntry) Format(withMetadata bool) string

type LogSource

type LogSource string
const (
	StdoutLogSource LogSource = "stdout"
	StderrLogSource LogSource = "stderr"
	HelperLogSource LogSource = "helper"
)

Jump to

Keyboard shortcuts

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