logsinks

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpBatch

type HttpBatch struct {
	MaxItems int
	MaxWait  time.Duration
}

type HttpCodec

type HttpCodec string
const (
	CodecEventJSON HttpCodec = "event_json"
	CodecText      HttpCodec = "text"
	CodecNDJSON    HttpCodec = "ndjson"
	CodecLoki      HttpCodec = "loki"
)

type HttpSink

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

func NewHttpSink

func NewHttpSink(
	name string,
	deviceID string,
	url string,
	method string,
	timeout time.Duration,
	headers map[string]string,
	codec HttpCodec,
	queueSize int,
	batch HttpBatch,
) *HttpSink

func (*HttpSink) Close

func (s *HttpSink) Close() error

func (*HttpSink) Push

func (s *HttpSink) Push(ev LogEvent) bool

func (*HttpSink) Start

func (s *HttpSink) Start()

type LogEvent

type LogEvent struct {
	Time  time.Time      `json:"time"`
	Level string         `json:"level"`
	Msg   string         `json:"msg"`
	Attrs map[string]any `json:"attrs,omitempty"`
}

type Queue

type Queue[T any] struct {
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue[T any](size int) *Queue[T]

func (*Queue[T]) Chan

func (q *Queue[T]) Chan() <-chan T

func (*Queue[T]) Close

func (q *Queue[T]) Close()

func (*Queue[T]) Push

func (q *Queue[T]) Push(v T) bool

type SinkAdapter

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

func NewSinkAdapter

func NewSinkAdapter(minLevel slog.Level, push func(LogEvent) bool) *SinkAdapter

func (*SinkAdapter) Enabled

func (a *SinkAdapter) Enabled(ctx context.Context, level slog.Level) bool

func (*SinkAdapter) Handle

func (a *SinkAdapter) Handle(ctx context.Context, r slog.Record) error

func (*SinkAdapter) WithAttrs

func (a *SinkAdapter) WithAttrs(attrs []slog.Attr) slog.Handler

func (*SinkAdapter) WithGroup

func (a *SinkAdapter) WithGroup(name string) slog.Handler

type UdpSink

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

func NewUdpSink

func NewUdpSink(name, addr string, queueSize int) *UdpSink

func (*UdpSink) Close

func (s *UdpSink) Close() error

func (*UdpSink) Push

func (s *UdpSink) Push(ev LogEvent) bool

func (*UdpSink) Start

func (s *UdpSink) Start()

Jump to

Keyboard shortcuts

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