logfmt

package module
v0.0.0-...-46bb7b2 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const KEY = 57347
View Source
const LogfmtExprEofCode = 1
View Source
const LogfmtExprErrCode = 2
View Source
const LogfmtExprFlag = -1000
View Source
const LogfmtExprInitialStackSize = 16
View Source
const LogfmtExprLast = 8
View Source
const LogfmtExprPrivate = 57344
View Source
const STRING = 57346

Variables

View Source
var (
	LogfmtExprDebug        = 0
	LogfmtExprErrorVerbose = false
)
View Source
var LogfmtExprAct = [...]int8{
	6, 5, 6, 4, 1, 2, 7, 3,
}
View Source
var LogfmtExprChk = [...]int16{
	-1000, -4, -3, -1, -2, 5, 4, -2,
}
View Source
var LogfmtExprDef = [...]int8{
	0, -2, 1, 2, 3, 5, 6, 4,
}
View Source
var LogfmtExprErrorMessages = [...]struct {
	state int
	token int
	msg   string
}{}
View Source
var LogfmtExprExca = [...]int8{
	-1, 1,
	1, -1,
	-2, 0,
}
View Source
var LogfmtExprPact = [...]int16{
	-4, -1000, -2, -1000, -1000, -1000, -1000, -1000,
}
View Source
var LogfmtExprPgo = [...]int8{
	0, 7, 3, 5, 4,
}
View Source
var LogfmtExprR1 = [...]int8{
	0, 4, 3, 3, 3, 1, 2,
}
View Source
var LogfmtExprR2 = [...]int8{
	0, 1, 1, 1, 2, 1, 1,
}
View Source
var LogfmtExprStatenames = [...]string{}
View Source
var LogfmtExprTok1 = [...]int8{
	1,
}
View Source
var LogfmtExprTok2 = [...]int8{
	2, 3, 4, 5,
}
View Source
var LogfmtExprTok3 = [...]int8{
	0,
}
View Source
var LogfmtExprToknames = [...]string{
	"$end",
	"error",
	"$unk",
	"STRING",
	"KEY",
}

Functions

func LogfmtExprErrorMessage

func LogfmtExprErrorMessage(state, lookAhead int) string

func LogfmtExprParse

func LogfmtExprParse(LogfmtExprlex LogfmtExprLexer) int

func LogfmtExprStatname

func LogfmtExprStatname(s int) string

func LogfmtExprTokname

func LogfmtExprTokname(c int) string

func LogfmtExprlex1

func LogfmtExprlex1(lex LogfmtExprLexer, lval *LogfmtExprSymType) (char, token int)

func Parse

func Parse(expr string, debug bool) ([]interface{}, error)

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) EOL

func (dec *Decoder) EOL() bool

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 LogfmtExprLexer

type LogfmtExprLexer interface {
	Lex(lval *LogfmtExprSymType) int
	Error(s string)
}

type LogfmtExprParser

type LogfmtExprParser interface {
	Parse(LogfmtExprLexer) int
	Lookahead() int
}

func LogfmtExprNewParser

func LogfmtExprNewParser() LogfmtExprParser

type LogfmtExprParserImpl

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

func (*LogfmtExprParserImpl) Lookahead

func (p *LogfmtExprParserImpl) Lookahead() int

func (*LogfmtExprParserImpl) Parse

func (LogfmtExprrcvr *LogfmtExprParserImpl) Parse(LogfmtExprlex LogfmtExprLexer) int

type LogfmtExprSymType

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

type Scanner

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

func NewScanner

func NewScanner(r io.Reader, debug bool) *Scanner

func (*Scanner) Error

func (sc *Scanner) Error(s string)

func (*Scanner) Lex

func (sc *Scanner) Lex(lval *LogfmtExprSymType) int

func (*Scanner) Reduced

func (sc *Scanner) Reduced(rule, state int, lval *LogfmtExprSymType) bool

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