prettylog

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: LGPL-2.1 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler represents a type that contains a slog.Handler, a function, a bytes.Buffer, and a sync.Mutex.

func NewHandler

func NewHandler(opts *slog.HandlerOptions, format OutputFormat) *Handler

NewHandler is a function that creates a new instance of the Handler struct

func (*Handler) Enabled

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

Enabled checks if the log handler is enabled for the given log level

func (*Handler) Handle

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

Handle is a method of the Handler struct that handles a slog.Record and returns an error

func (*Handler) WithAttrs

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

WithAttrs returns a new log handler with additional attributes

func (*Handler) WithGroup

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

WithGroup returns a new log handler with the specified group name

type OutputFormat added in v0.0.9

type OutputFormat int

OutputFormat custom type

const (
	JSONFormat OutputFormat = iota
	TextFormat
)

custom

Jump to

Keyboard shortcuts

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