parser

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level int

Level represents log severity

const (
	LevelDebug Level = iota
	LevelInfo
	LevelWarn
	LevelError
	LevelFatal
)

func ParseLevel

func ParseLevel(s string) Level

ParseLevel converts a string to a Level

func (Level) String

func (l Level) String() string

type LogEntry

type LogEntry struct {
	Timestamp  time.Time
	Level      Level
	Logger     string
	Message    string
	Caller     string
	Fields     map[string]interface{}
	TraceID    string
	SpanID     string
	Source     string
	ParseError string // Set when parsing fails
}

LogEntry represents a standardized log entry

func NewLogEntry

func NewLogEntry() *LogEntry

NewLogEntry creates a new log entry with defaults

type Parser

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

Parser parses log lines from various formats

func NewParser

func NewParser() *Parser

NewParser creates a new parser

func (*Parser) Parse

func (p *Parser) Parse(line []byte) *LogEntry

Parse attempts to parse a log line and extract structured data Always returns a LogEntry (never nil). On parse failure, sets ParseError field

Jump to

Keyboard shortcuts

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