logger

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LevelNames = map[string]slog.Level{
	"debug": slog.LevelDebug,
	"info":  slog.LevelInfo,
	"warn":  slog.LevelWarn,
	"error": slog.LevelError,
}

Functions

func CompactAny

func CompactAny(val interface{}) *compactAny

CompactAny wraps any value to show it in log truncated

func CompactValue

func CompactValue[T string | []byte](v T) *compactValue[T]

CompactValue wraps any scalar value to show it in log truncated

func CompactValues

func CompactValues[T string | []byte, S []T](v S) []*compactValue[T]

func InitLogger

func InitLogger(format string, level string) (slog.Handler, error)

Types

type Config added in v1.5.4

type Config struct {
	LogLevel  string `toml:"level"`
	LogFormat string `toml:"format"`
	Debug     bool   `toml:"debug"`
}

func NewConfig added in v1.5.4

func NewConfig() Config

func (Config) ToToml added in v1.5.4

func (c Config) ToToml() string

Jump to

Keyboard shortcuts

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