logging

package
v2.5.4 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLogLineToLong = errors.New("log line too long, discarding")
)

Functions

func JSONToLog

func JSONToLog(l zerolog.Logger, msg map[string]any)

Types

type LogReader

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

logReader is a custom implementation similar to bufio.Scanner, but provides a way to handle lines (or tokens) that exceed the buffer size.

func NewLogReader

func NewLogReader(reader io.ReadCloser) *LogReader

newLogReader creates a new logReader to read log lines from an io.ReadCloser

func (*LogReader) NextLine

func (r *LogReader) NextLine() ([]byte, error)

NextLine reads and returns the next log line from the reader. An io.EOF error is returned if the end of the stream has been reached. This implementation is different from bufio.Scanner as it also returns an error if a line is too long to fit into the buffer. In this case, an error is returned together with a limited prefix of the line.

Jump to

Keyboard shortcuts

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