format

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FactoryJSON        = "json"
	FactoryRegex       = "regex"
	FactoryRfc3339Nano = "rfc3339Nano"
	FactoryJSONCustom  = "json_custom"
	FactoryCRI         = "cri"
)
View Source
const (
	DefBufferSize = 4 << 10 // 4K
	MaxRecordSize = pool.MaxRecordSize
)

Variables

View Source
var (
	ErrFormatDetect   = errors.New("fail to detect log format")
	ErrNoTimestamp    = errors.New("no timestamp delimeter")
	ErrNoStreamType   = errors.New("no stream delimeter")
	ErrNoTag          = errors.New("no tag delimeter")
	ErrUnknownStream  = errors.New("unknown stream type")
	ErrParseTimestamp = errors.New("fail parse timestamp")
	ErrJsonTimeField  = errors.New("fail to extract time field")
	ErrJsonUnmarshal  = errors.New("fail JSON unmarshal")
	ErrMatchTimestamp = errors.New("fail match timestamp")
)

Functions

This section is empty.

Types

type DetectFormatFunc

type DetectFormatFunc func(line []byte) (FactoryI, int64, error)

type FactoryI

type FactoryI interface {
	New() ParserI
	String() string
}

func Detect

func Detect(rdr io.Reader) (FactoryI, int64, error)

func NewJsonCustomFactory

func NewJsonCustomFactory(pathTime, fmtTime string) (FactoryI, error)

func NewJsonFactory

func NewJsonFactory() FactoryI

func NewRegexFactory

func NewRegexFactory(expTime string, cb TimeFormatCbT) (FactoryI, error)

type LogEntry

type LogEntry = entry.LogEntry

type ParserI

type ParserI interface {
	ReadTimestamp(rdr io.Reader) (int64, error)
	ReadEntry(line []byte) (LogEntry, error)
}

type TimeFormatCbT

type TimeFormatCbT func(m []byte) (int64, error)

func WithTimeFormat

func WithTimeFormat(fmtTime string) TimeFormatCbT

Jump to

Keyboard shortcuts

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