ecsslog

package module
v0.0.0-...-543f420 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: Apache-2.0 Imports: 6 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

func Error

func Error(err error) slog.Attr

I'm not quite happy with this approach myself. Keeping it as a reference.

Types

type Config

type Config struct {
	Writer io.Writer
	// 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 NewHandler

func NewHandler(c Config) *Handler

func (*Handler) Enabled

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

TODO should be handled by ecsslog.Handler

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

TODO add a clone method for convenience

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