logging

package
v0.0.0-...-721006d Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

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

A Decoder reads and decodes structured log messages from an input stream.

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

NewDecoder returns a new decoder that reads from r.

func (*Decoder) Decode

func (d *Decoder) Decode(v *Message) error

Decode reads the next value from its input and stores it in the value pointed to by v.

type Encoder

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

An Encoder writes structured log messages to an output stream.

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

NewEncoder returns a new encoder that writes to w.

func (*Encoder) Encode

func (e *Encoder) Encode(v Message) error

Encode writes the binary encoding of v to the stream.

type IOStream

type IOStream int

IOStream represents a Unix standard stream as a flag.

const (
	Stdin IOStream = iota
	Stdout
	Stderr
)

IOStream flag definitions

type LogReader

type LogReader interface {
	io.Closer

	// ReadMessage reads the next log message emitted by container.
	// Note: Time field in message is set in UTC.
	//
	// Returns nil, io.EOF if all log messages emitted by container
	// have been consumed.
	ReadMessage() (*Message, error)
}

LogReader provides ReadMessage() which reads a structured log message in sequential order as emitted by the container.

type Message

type Message struct {
	Stream IOStream
	Time   time.Time
	Text   string
}

A Message is a structured log message. Text includes trailing newlines if present.

Jump to

Keyboard shortcuts

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