Documentation ¶
Overview ¶
Adapted from https://github.com/go-logfmt/logfmt/ but []byte as parameter instead Original license is MIT.
Index ¶
- Constants
- Variables
- func LogfmtExprErrorMessage(state, lookAhead int) string
- func LogfmtExprParse(LogfmtExprlex LogfmtExprLexer) int
- func LogfmtExprStatname(s int) string
- func LogfmtExprTokname(c int) string
- func LogfmtExprlex1(lex LogfmtExprLexer, lval *LogfmtExprSymType) (char, token int)
- func Parse(expr string, debug bool) ([]interface{}, error)
- type Decoder
- type LogfmtExprLexer
- type LogfmtExprParser
- type LogfmtExprParserImpl
- type LogfmtExprSymType
- type Scanner
- type SyntaxError
Constants ¶
const KEY = 57347
const LogfmtExprEofCode = 1
const LogfmtExprErrCode = 2
const LogfmtExprFlag = -1000
const LogfmtExprInitialStackSize = 16
const LogfmtExprLast = 8
const LogfmtExprPrivate = 57344
const STRING = 57346
Variables ¶
var ( LogfmtExprDebug = 0 LogfmtExprErrorVerbose = false )
var LogfmtExprAct = [...]int8{
6, 5, 6, 4, 1, 2, 7, 3,
}
var LogfmtExprChk = [...]int16{
-1000, -4, -3, -1, -2, 5, 4, -2,
}
var LogfmtExprDef = [...]int8{
0, -2, 1, 2, 3, 5, 6, 4,
}
var LogfmtExprErrorMessages = [...]struct { state int token int msg string }{}
var LogfmtExprExca = [...]int8{
-1, 1,
1, -1,
-2, 0,
}
var LogfmtExprPact = [...]int16{
-4, -1000, -2, -1000, -1000, -1000, -1000, -1000,
}
var LogfmtExprPgo = [...]int8{
0, 7, 3, 5, 4,
}
var LogfmtExprR1 = [...]int8{
0, 4, 3, 3, 3, 1, 2,
}
var LogfmtExprR2 = [...]int8{
0, 1, 1, 1, 2, 1, 1,
}
var LogfmtExprStatenames = [...]string{}
var LogfmtExprTok1 = [...]int8{
1,
}
var LogfmtExprTok2 = [...]int8{
2, 3, 4, 5,
}
var LogfmtExprTok3 = [...]int8{
0,
}
var LogfmtExprToknames = [...]string{
"$end",
"error",
"$unk",
"STRING",
"KEY",
}
Functions ¶
func LogfmtExprErrorMessage ¶
func LogfmtExprParse ¶
func LogfmtExprParse(LogfmtExprlex LogfmtExprLexer) int
func LogfmtExprStatname ¶
func LogfmtExprTokname ¶
func LogfmtExprlex1 ¶
func LogfmtExprlex1(lex LogfmtExprLexer, lval *LogfmtExprSymType) (char, token int)
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
A Decoder reads and decodes logfmt records from an input stream.
func NewDecoder ¶
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) Key ¶
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) ScanKeyval ¶
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.
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 (*Scanner) Lex ¶
func (sc *Scanner) Lex(lval *LogfmtExprSymType) int
type SyntaxError ¶
A SyntaxError represents a syntax error in the logfmt input stream.
func (*SyntaxError) Error ¶
func (e *SyntaxError) Error() string