utils

package
v0.0.20 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Env added in v0.0.15

func Env() types.EnvVars

func ErrLog added in v0.0.7

func ErrLog(err error) slog.Attr

func HandleError added in v0.0.16

func HandleError(err error)

func LoadEnv added in v0.0.15

func LoadEnv(envs ...EnvLoader) error

func Logger

func Logger() *slog.Logger

func ReconfigureLogger

func ReconfigureLogger(w io.Writer, level slog.Level, format LogFormat)

func SafeClose added in v0.0.14

func SafeClose(c Closer)

func SafeWrite added in v0.0.15

func SafeWrite(w io.Writer, b []byte)

func ToPtrSlice added in v0.0.15

func ToPtrSlice[T any](x []T) []*T

Types

type Closer added in v0.0.14

type Closer interface {
	Close() error
}

type EnvLoader added in v0.0.15

type EnvLoader func() error

func EnvDef added in v0.0.17

func EnvDef(key string, dst *string) EnvLoader

type LogFormat added in v0.0.14

type LogFormat int
const (
	LogFormatConsole LogFormat = iota + 1
	LogFormatJSON
)

Jump to

Keyboard shortcuts

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