slogext

package
v1.47.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package slogext implements extended functionality for slog.

Index

Constants

This section is empty.

Variables

View Source
var (
	// NopLogger is a no-op Logger.
	NopLogger = slog.New(NopHandler)
	// NopHandler is no-op Handler.
	NopHandler slog.Handler = nopHandler{}
)

Functions

func DebugProfile

func DebugProfile(logger *slog.Logger, extraFields ...any) func()

DebugProfile will result in the function's elapsed time being printed as a debug log line.

func ErrorAttr

func ErrorAttr(err error) slog.Attr

ErrorAttr returns a slog.Attr for the error.

If err is nil, this returns slog.Attr{}.

Types

This section is empty.

Jump to

Keyboard shortcuts

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