package loki

import "git.sr.ht/~pingoo/stdx/log/loki"

Index

Types

type Writer

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

func NewWriter

func NewWriter(ctx context.Context, lokiEndpoint string, streams map[string]string, options *WriterOptions) *Writer

func (*Writer) SetEndpoint

func (writer *Writer) SetEndpoint(lokiEndpoint string)

SetEndpoint sets the loki endpoint. This method IS NOT thread safe. It should be used just after config is loaded

func (*Writer) Write

func (writer *Writer) Write(data []byte) (n int, err error)

type WriterOptions

type WriterOptions struct {
	LokiEndpoint string
	// ChildWriter is used to pass logs to another writer
	// default: os.Stdout
	ChildWriter io.Writer
	// DefaultRecordsBufferSize is your expected number of `(logs per second) / (1000 / FlushTimeout)`
	// default: 100
	DefaultRecordsBufferSize uint32
	// EmptyEndpointMaxBufferSize is the number of logs to buffer if LokiEndpoint == "".
	// it's useful if you log a few things before your config with the loki endpoint is full loaded
	// default: 200
	EmptyEndpointMaxBufferSize uint32
	// FlushTimeout in ms
	// default: 200
	FlushTimeout uint32
}

Source Files

loki.go writer.go

Version
v0.0.0-20240218134121-094174641f6e (latest)
Published
Feb 18, 2024
Platform
linux/amd64
Imports
14 packages
Last checked
4 months ago

Tools for package owners.