Documentation
¶
Index ¶
- Constants
- func AddAttribute(ctx context.Context, key string, value any)
- func AddAttributes(ctx context.Context, attributes map[string]any)
- func AddError(ctx context.Context, err error)
- func AddStack(ctx context.Context, stack string)
- func ContextWithLogger(ctx context.Context, logger *slog.Logger) context.Context
- func ContextWithSlog(ctx context.Context) context.Context
- func DefaultConnectHealthCheckUnaryFilter(spec connect.Spec) bool
- func GetAttribute[T any](ctx context.Context, key string) T
- func GetAttributes(ctx context.Context) map[string]any
- func GetError(ctx context.Context) error
- func GetStack(ctx context.Context) string
- func LoggerFromContext(ctx context.Context) *slog.Logger
- func NewSlogConnectInterceptor(opts ...ConnectOption) connect.Interceptor
- func NewSlogConnectUnaryInterceptor(opts ...ConnectOption) connect.UnaryInterceptorFunc
- func SlogChiMiddleware(opts ...ChiOption) func(http.Handler) http.Handler
- type AttributesHandler
- type ChiOption
- type ConnectOption
- type ConnectTextHandler
- type HTTPTextHandler
- type Level
- type TextHandlerConfig
- type TextHandlerOption
Constants ¶
View Source
const ( ErrorAttributeKey = "error.message" StackAttributeKey = "error.stack" )
Variables ¶
This section is empty.
Functions ¶
func ContextWithLogger ¶ added in v0.0.2
ContextWithLogger returns a new context carrying the given *slog.Logger.
func LoggerFromContext ¶ added in v0.0.2
LoggerFromContext retrieves the *slog.Logger from context. If none is set, returns slog.Default().
func NewSlogConnectInterceptor ¶
func NewSlogConnectInterceptor(opts ...ConnectOption) connect.Interceptor
func NewSlogConnectUnaryInterceptor ¶
func NewSlogConnectUnaryInterceptor(opts ...ConnectOption) connect.UnaryInterceptorFunc
Types ¶
type AttributesHandler ¶
type AttributesHandler struct {
// contains filtered or unexported fields
}
func NewAttributesHandler ¶
func NewAttributesHandler(handler slog.Handler) *AttributesHandler
type ConnectOption ¶
type ConnectOption interface {
// contains filtered or unexported methods
}
func WithConnectFilter ¶
func WithConnectFilter(filter func(connect.Spec) bool) ConnectOption
type ConnectTextHandler ¶
type ConnectTextHandler struct {
// contains filtered or unexported fields
}
func NewConnectTextHandler ¶
func NewConnectTextHandler(w io.Writer, opts ...TextHandlerOption) *ConnectTextHandler
type HTTPTextHandler ¶
type HTTPTextHandler struct {
// contains filtered or unexported fields
}
func NewHTTPTextHandler ¶
func NewHTTPTextHandler(w io.Writer, opts ...TextHandlerOption) *HTTPTextHandler
type TextHandlerConfig ¶
type TextHandlerOption ¶
type TextHandlerOption func(*TextHandlerConfig)
func WithColor ¶
func WithColor(c bool) TextHandlerOption
func WithLevel ¶
func WithLevel(level slog.Level) TextHandlerOption
Click to show internal directories.
Click to hide internal directories.