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: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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