logger

package
v0.0.0-...-69e7fd1 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatJson   = "json"
	FormatText   = "text"
	FormatPretty = "pretty"
	FormatStub   = "stub"

	LevelDebug = "debug"
	LevelInfo  = "info"
	LevelWarn  = "warn"
	LevelError = "error"
)

Variables

This section is empty.

Functions

func New

func New(format, level string) *slog.Logger

Types

type Config

type Config struct {
	Format string
	Level  string
}

type PrettyHandler

type PrettyHandler struct {
	slog.Handler
	// contains filtered or unexported fields
}

func NewPrettyHandler

func NewPrettyHandler(out io.Writer, opts *slog.HandlerOptions) *PrettyHandler

func (*PrettyHandler) Handle

func (h *PrettyHandler) Handle(_ context.Context, r slog.Record) error

func (*PrettyHandler) WithAttrs

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

func (*PrettyHandler) WithGroup

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

type StubHandler

type StubHandler struct{}

func NewStubHandler

func NewStubHandler(_ io.Writer, _ *slog.HandlerOptions) *StubHandler

func (*StubHandler) Enabled

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

func (*StubHandler) Handle

func (h *StubHandler) Handle(_ context.Context, _ slog.Record) error

func (*StubHandler) WithAttrs

func (h *StubHandler) WithAttrs(_ []slog.Attr) slog.Handler

func (*StubHandler) WithGroup

func (h *StubHandler) WithGroup(_ string) slog.Handler

Jump to

Keyboard shortcuts

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