logger

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustNewFromEnv

func MustNewFromEnv() *slog.Logger

MustNewFromEnv creates a new logger configured with environment variables. Panics when an error occurs.

func New

func New(conf Config) (*slog.Logger, error)

New create a new logger based on the config and sets it as default.

Types

type Config

type Config struct {
	// Level must be one of [debug, info, warn, error]
	Level string `env:"LOG_LEVEL"`
	// Format must be one of [text, json]
	Format string `env:"LOG_FORMAT"`
}

Config for the logger

Jump to

Keyboard shortcuts

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