log

package
v0.19.5 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimeFormatRFC       = "rfc3339"
	TimeFormatTimestamp = "timestamp"
)
View Source
const (
	LevelDebug int = -4
	LevelInfo  int = 0
	LevelWarn  int = 4
	LevelError int = 8
)

Levels ref: https://pkg.go.dev/log/slog#Level

View Source
const (
	FormatText = "text"
	FormatJSON = "json"
)
View Source
const (
	OutputStdOut = 0
	OutputStdErr = 1
)

Variables

This section is empty.

Functions

func Logger

func Logger() *slog.Logger

func New

func New(cfg *Config)

Types

type Config added in v0.19.2

type Config struct {
	Format     string `mapstructure:"format" envVar:"ATMK_LOG_FORMAT"`
	Level      int    `mapstructure:"level" envVar:"ATMK_LOG_LEVEL"`
	Output     int    `mapstructure:"output" envVar:"ATMK_LOG_OUTPUT"`
	TimeFormat string `mapstructure:"timeFormat" envVar:"ATMK_LOG_TIMEF"`
}

func Configure added in v0.19.2

func Configure(key ...string) (*Config, error)

func Defaults added in v0.19.2

func Defaults() *Config

type Ctx

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

func With added in v0.19.2

func With(kvs ...any) Ctx

func (Ctx) Debug

func (c Ctx) Debug(msg string, args ...any)

func (Ctx) Error

func (c Ctx) Error(msg string, args ...any)

func (Ctx) Info

func (c Ctx) Info(msg string, args ...any)

func (Ctx) Warn added in v0.19.2

func (c Ctx) Warn(msg string, args ...any)

func (Ctx) With added in v0.19.2

func (c Ctx) With(kvs ...any) Ctx

Jump to

Keyboard shortcuts

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