logfmt

package
v2.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Adapted from https://github.com/go-logfmt/logfmt/ but []byte as parameter instead Original license is MIT.

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 logfmt records from an input stream.

func NewDecoder

func NewDecoder(line []byte) *Decoder

NewDecoder returns a new decoder that reads from r.

The decoder introduces its own buffering and may read data from r beyond the logfmt records requested.

func (*Decoder) Err

func (dec *Decoder) Err() error

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

func (*Decoder) Key

func (dec *Decoder) Key() []byte

Key returns the most recent key found by a call to ScanKeyval. The returned slice may point to internal buffers and is only valid until the next call to ScanRecord. It does no allocation.

func (*Decoder) Reset

func (dec *Decoder) Reset(line []byte)

func (*Decoder) ScanKeyval

func (dec *Decoder) ScanKeyval() bool

ScanKeyval advances the Decoder to the next key/value pair of the current record, which can then be retrieved with the Key and Value methods. It returns false when decoding stops, either by reaching the end of the current record or an error.

func (*Decoder) Value

func (dec *Decoder) Value() []byte

Value returns the most recent value found by a call to ScanKeyval. The returned slice may point to internal buffers and is only valid until the next call to ScanRecord. It does no allocation when the value has no escape sequences.

type SyntaxError

type SyntaxError struct {
	Msg string
	Pos int
}

A SyntaxError represents a syntax error in the logfmt input stream.

func (*SyntaxError) Error

func (e *SyntaxError) Error() string

Jump to

Keyboard shortcuts

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