Documentation ¶
Index ¶
- Variables
- func Apply(opt HandlerOption)
- func Error(err error) slog.Attr
- func ErrorValue(err error) slog.Value
- func FromContext(ctx context.Context) *slog.Logger
- func NewContext(ctx context.Context, logger *slog.Logger) context.Context
- func NewHandler(hdl slog.Handler, opts ...HandlerOption) slog.Handler
- func NewLog(opt Options) *slog.Logger
- type HandleFunc
- type Handler
- type HandlerOption
- type Options
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorKey = "error"
Functions ¶
func Apply ¶ added in v0.3.4
func Apply(opt HandlerOption)
func ErrorValue ¶
func NewContext ¶ added in v0.3.2
func NewHandler ¶
func NewHandler(hdl slog.Handler, opts ...HandlerOption) slog.Handler
Types ¶
type Handler ¶ added in v0.3.3
type Handler struct {
// contains filtered or unexported fields
}
func (*Handler) Apply ¶ added in v0.3.3
func (ch *Handler) Apply(opt HandlerOption)
type HandlerOption ¶
type HandlerOption func(*Handler)
func WithDisableStackTrace ¶
func WithDisableStackTrace(disabled bool) HandlerOption
func WithHandleFunc ¶ added in v0.3.3
func WithHandleFunc(fn HandleFunc) HandlerOption
func WithStackKey ¶
func WithStackKey(key string) HandlerOption
type Options ¶ added in v0.3.4
type Options struct { Level string `json:"level" toml:"level" yaml:"level"` Output string `json:"output" toml:"output" yaml:"output"` MaxSize int `json:"max_size" toml:"max_size" yaml:"max_size"` MaxAge int `json:"max_age" toml:"max_age" yaml:"max_age"` MaxBackups int `json:"max_backups" toml:"max_backups" yaml:"max_backups"` LocalTime bool `json:"local_time" toml:"local_time" yaml:"local_time"` Compress bool `json:"compress" toml:"compress" yaml:"compress"` }
Click to show internal directories.
Click to hide internal directories.