logx

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromContext

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

func New

func New(cfg Config) *slog.Logger

func NewContext

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

func RequestID

func RequestID(ctx context.Context) string

func With

func With(ctx context.Context, attrs ...any) context.Context

func WithRequestID

func WithRequestID(ctx context.Context, requestID string) context.Context

Types

type Config

type Config struct {
	Level     string `json:"level" yaml:"level"`
	Format    string `json:"format" yaml:"format"`
	AddSource bool   `json:"add_source" yaml:"add_source"`
}

type RequestIDKey

type RequestIDKey struct{}

Jump to

Keyboard shortcuts

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