logpipe

package
v1.16.13 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToLogger

func ToLogger(logger log.Logger) func(e LogEntry)

func ToLoggerWithMinLevel

func ToLoggerWithMinLevel(logger log.Logger, minLevel slog.Level) func(e LogEntry)

Types

type LineBuffer

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

LineBuffer is an io.WriteCloser that buffers data across writes and emits complete lines to the provided callback, preserving log entries that may span multiple writes. Any trailing partial line is flushed when Close is called.

func NewLineBuffer

func NewLineBuffer(callback LogCallback) *LineBuffer

NewLineBuffer creates a new LineBuffer that calls the given callback for each complete line.

func (*LineBuffer) Close

func (lp *LineBuffer) Close() error

Close flushes any buffered partial line.

func (*LineBuffer) Write

func (lp *LineBuffer) Write(p []byte) (int, error)

Write appends data, emitting full lines to the callback. Empty lines are ignored.

type LogCallback

type LogCallback func(line []byte)

LogCallback is the function signature for processing a complete log line.

type LogEntry

type LogEntry interface {
	LogLevel() slog.Level
	LogMessage() string
	LogFields() []any
	FieldValue(key string) any
}

func ParseGoStructuredLogs

func ParseGoStructuredLogs(line []byte) LogEntry

func ParseRustStructuredLogs

func ParseRustStructuredLogs(line []byte) LogEntry

type LogParser

type LogParser func(line []byte) LogEntry

type StructuredGoLogEntry

type StructuredGoLogEntry struct {
	Message string
	Level   slog.Level
	Fields  map[string]any
}

func (StructuredGoLogEntry) FieldValue

func (e StructuredGoLogEntry) FieldValue(key string) any

func (StructuredGoLogEntry) LogFields

func (e StructuredGoLogEntry) LogFields() []any

func (StructuredGoLogEntry) LogLevel

func (e StructuredGoLogEntry) LogLevel() slog.Level

func (StructuredGoLogEntry) LogMessage

func (e StructuredGoLogEntry) LogMessage() string

type StructuredRustLogEntry

type StructuredRustLogEntry struct {
	Message string
	Level   slog.Level
	Fields  map[string]any
}

func (StructuredRustLogEntry) FieldValue

func (e StructuredRustLogEntry) FieldValue(key string) any

func (StructuredRustLogEntry) LogFields

func (e StructuredRustLogEntry) LogFields() []any

func (StructuredRustLogEntry) LogLevel

func (e StructuredRustLogEntry) LogLevel() slog.Level

func (StructuredRustLogEntry) LogMessage

func (e StructuredRustLogEntry) LogMessage() string

Jump to

Keyboard shortcuts

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