sloghighlight

package module
v0.0.0-...-2b9f7be Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2023 License: MIT Imports: 10 Imported by: 3

README

slog-highlight

Go Reference GitHub go.mod Go version (subdirectory of monorepo) Go Report Card Maintainability codecov ci GitHub contributors

This library implements the slog handler for the highlight.io logging service.

Usage

See examples directory for usage examples.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHighlightHandler

func NewHighlightHandler(options ...HighlightHandlerOption) slog.Handler

NewHighlightHandler creates a new HighlightHandler. Default level is LevelInfo.

Types

type HighlightHandler

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

func (*HighlightHandler) Enabled

func (h *HighlightHandler) Enabled(_ context.Context, level slog.Level) bool

Enabled returns true if the level is enabled.

func (*HighlightHandler) Handle

func (h *HighlightHandler) Handle(ctx context.Context, r slog.Record) error

Handle handles the record.

func (*HighlightHandler) WithAttrs

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

WithLevel returns a new HighlightHandler with the attributes added.

func (*HighlightHandler) WithGroup

func (h *HighlightHandler) WithGroup(name string) slog.Handler

WithGroup returns a new HighlightHandler with the group added.

type HighlightHandlerOption

type HighlightHandlerOption func(*HighlightHandler) error

func WithLevel

func WithLevel(level slog.Leveler) HighlightHandlerOption

func WithLevelFunc

func WithLevelFunc(levelFunc func() slog.Leveler) HighlightHandlerOption

Directories

Path Synopsis
examples
api Module
minimal Module
multi Module

Jump to

Keyboard shortcuts

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