livelog

package
v1.0.4-gitspaces-beta Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStreamNotFound = errors.New("stream: not found")

ErrStreamNotFound is returned when a stream is not registered with the streamer.

WireSet provides a wire set for this package.

Functions

This section is empty.

Types

type Line

type Line struct {
	Number    int    `json:"pos"`
	Message   string `json:"out"`
	Timestamp int64  `json:"time"`
}

Line represents a line in the logs.

type LogStream

type LogStream interface {
	// Create creates the log stream for the step ID.
	Create(context.Context, int64) error

	// Delete deletes the log stream for the step ID.
	Delete(context.Context, int64) error

	// Writes writes to the log stream.
	Write(context.Context, int64, *Line) error

	// Tail tails the log stream.
	Tail(context.Context, int64) (<-chan *Line, <-chan error)

	// Info returns internal stream information.
	Info(context.Context) *LogStreamInfo
}

LogStream manages a live stream of logs.

func NewMemory

func NewMemory() LogStream

New returns a new in-memory log streamer.

func ProvideLogStream

func ProvideLogStream() LogStream

ProvideLogStream provides an implementation of a logs streamer.

type LogStreamInfo

type LogStreamInfo struct {
	// Streams is a key-value pair where the key is the step
	// identifier, and the value is the count of subscribers
	// streaming the logs.
	Streams map[int64]int `json:"streams"`
}

LogStreamInfo provides internal stream information. This can be used to monitor the number of registered streams and subscribers.

Jump to

Keyboard shortcuts

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