ecsslog

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

README

ecs-logging-go-slog

Elastic Common Schema (ECS) support for log/slog

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	HandlerOptions slog.HandlerOptions

	// enables customizing of how log levels would look (INFO, info, INF, etc.)
	LevelNamer func(slog.Level) string
}

type Handler

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

func NewECSHandler

func NewECSHandler(writer io.Writer, config Config) *Handler

func (*Handler) Enabled

func (x *Handler) Enabled(ctx context.Context, level slog.Level) bool

func (*Handler) Handle

func (x *Handler) Handle(ctx context.Context, record slog.Record) error

func (*Handler) WithAttrs

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

func (*Handler) WithGroup

func (x *Handler) WithGroup(name string) slog.Handler

Jump to

Keyboard shortcuts

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