logstream

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinBufferSize     = 512
	DefaultBufferSize = 65536
)

Variables

View Source
var ErrInvalidUTF8 = goerrors.New("invalid UTF8 encoding")

Functions

This section is empty.

Types

type JSONArrayStream

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

JSONArrayStream is a log entry stream that iterates over the elements of a JSON Array. This can reduce memory overhead in cases log events are delivered as elements of an array instead of one per-line.

func NewJSONArrayStream

func NewJSONArrayStream(r io.Reader, size int, path ...string) *JSONArrayStream

NewJSONArrayStream creates a new JSON Array stream. r is the underlying io.Reader size is the read buffer size for the jsoniter.Iterator path is a path to the array value to extract elements from (empty means the input JSON is an array itself)

func (*JSONArrayStream) Err

func (s *JSONArrayStream) Err() error

Err implements the Stream interface

func (*JSONArrayStream) Next

func (s *JSONArrayStream) Next() []byte

Next implements the Stream interface

type LineStream

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

func NewLineStream

func NewLineStream(r io.Reader, size int) *LineStream

func (*LineStream) Err

func (s *LineStream) Err() error

Err returns the first non-EOF error that was encountered by the Scanner.

func (*LineStream) Next

func (s *LineStream) Next() []byte

Next reads the next line from the log.

type Stream

type Stream interface {
	// Next will read the next log entry.
	// If it returns `nil` no more log entries are available in the stream.
	// The slice returned is stable until the next call to `Next()`
	Next() []byte
	// Err returns the first non-EOF error that was encountered by the Stream.
	Err() error
}

Stream is the common interface for reading log entries

Jump to

Keyboard shortcuts

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