xslog

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const Default = LevelInfo
View Source
const EnvKey = "LOG_LEVEL"

Variables

This section is empty.

Functions

func Action

func Action(action string) slog.Attr

func ActiveUsers added in v0.1.12

func ActiveUsers(count int) slog.Attr

func Backoff

func Backoff(d time.Duration) slog.Attr

func BindingMismatchGroup

func BindingMismatchGroup(tokenUserID, apiKeyUserID int64) slog.Attr

func Body added in v0.1.13

func Body(body string) slog.Attr

func ClientVersion

func ClientVersion(clientVersion string) slog.Attr

func Count

func Count(count int) slog.Attr

func CycleID

func CycleID(id int64) slog.Attr

func Data

func Data(data string) slog.Attr

func Duration

func Duration(duration time.Duration) slog.Attr

func DynamicLimit added in v0.1.12

func DynamicLimit(limit int) slog.Attr

func End

func End(t time.Time) slog.Attr

func EntityID

func EntityID(id string) slog.Attr

func EntityType

func EntityType(entityType string) slog.Attr

func Error

func Error(err error) slog.Attr

func ErrorAny

func ErrorAny(err any) slog.Attr

func ErrorGroup

func ErrorGroup(err error) slog.Attr

func ErrorGroupWithStack

func ErrorGroupWithStack(err any) slog.Attr

func FromContext

func FromContext(ctx context.Context) *slog.Logger

func HTTPStatus

func HTTPStatus(status int) slog.Attr

func IP

func IP(ip string) slog.Attr

func Message

func Message(msg string) slog.Attr

func MinVersion

func MinVersion(minVersion string) slog.Attr

func NewLogger

func NewLogger(w io.Writer, level Level) *slog.Logger

func NewLoggerFromEnv

func NewLoggerFromEnv(w io.Writer) *slog.Logger

func NewTextLogger

func NewTextLogger(w io.Writer, level Level) *slog.Logger

func NewTextLoggerFromEnv

func NewTextLoggerFromEnv(w io.Writer) *slog.Logger

func Path

func Path(path string) slog.Attr

func RateLimitGroup

func RateLimitGroup(retryAfter time.Duration, reason string) slog.Attr

func RequestGroup

func RequestGroup(r *http.Request) slog.Attr

func RequestID

func RequestID(requestID string) slog.Attr

func RequestIP

func RequestIP(r *http.Request) slog.Attr

func RequestMethod

func RequestMethod(r *http.Request) slog.Attr

func RequestPath

func RequestPath(r *http.Request) slog.Attr

func ResponseGroup

func ResponseGroup(status int, duration time.Duration) slog.Attr

func ServerVersion

func ServerVersion(serverVersion string) slog.Attr

func SessionID

func SessionID(id string) slog.Attr

func Since

func Since(since string) slog.Attr

func SinceTime

func SinceTime(t time.Time) slog.Attr

func Source added in v0.1.1

func Source(source string) slog.Attr

func Stack

func Stack() slog.Attr

func Start

func Start(t time.Time) slog.Attr

func Timestamp

func Timestamp(ts string) slog.Attr

func Type

func Type(t string) slog.Attr

func UserGroup

func UserGroup(userID int64) slog.Attr

func UserID

func UserID(id int64) slog.Attr

func ValidationGroup

func ValidationGroup(fields map[string]string) slog.Attr

func Version

func Version() slog.Attr

func WithAttrs

func WithAttrs(ctx context.Context, attrs ...slog.Attr) context.Context

func WithLogger

func WithLogger(ctx context.Context, logger *slog.Logger) context.Context

Types

type Level

type Level string
const (
	LevelDebug Level = "debug"
	LevelInfo  Level = "info"
	LevelWarn  Level = "warn"
	LevelError Level = "error"
)

func DefaultLevel

func DefaultLevel() Level

func FromEnv

func FromEnv() Level

func Parse

func Parse(s string) (Level, error)

func (Level) String

func (l Level) String() string

func (Level) ToSlog

func (l Level) ToSlog() slog.Level

Jump to

Keyboard shortcuts

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