human

package
v0.0.0-...-cf8a7de Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBuf

func GetBuf() *bytes.Buffer

GetBuffer fetches a buffer from the pool

func PutBuf

func PutBuf(buf *bytes.Buffer)

PutBuffer returns a buffer to the pool make sure to call this with defer()

Types

type Handler

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

Handler makes logs easy to read from the CLI

func NewHandler

func NewHandler(options HandlerOpts, w io.Writer) *Handler

func (*Handler) Enabled

func (s *Handler) Enabled(_ context.Context, level slog.Level) bool

doesn't log below its set level

func (*Handler) Handle

func (s *Handler) Handle(_ context.Context, r slog.Record) error

implements Handler.Handle.

func (*Handler) WithAttrs

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

implement interface

func (*Handler) WithGroup

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

implement interface

type HandlerOpts

type HandlerOpts struct {
	MinLevel    slog.Leveler
	DoSource    bool // TODO: should always print
	IgnoreAttrs []string
}

Jump to

Keyboard shortcuts

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