Documentation
¶
Index ¶
- Variables
- func FromContext(ctx context.Context) (*slog.Logger, error)
- func New(cfg LoggerConfig) *slog.Logger
- func ToContext(ctx context.Context, log *slog.Logger) context.Context
- type LoggerConfig
- type PlainHandler
- func (h *PlainHandler) Enabled(_ context.Context, lvl slog.Level) bool
- func (h *PlainHandler) Handle(_ context.Context, r slog.Record) error
- func (h *PlainHandler) WithAttrs(attrs []slog.Attr) slog.Handler
- func (h *PlainHandler) WithGroup(name string) slog.Handler
- func (h *PlainHandler) WithSource(b bool) *PlainHandler
- func (h *PlainHandler) WithTimestamp(b bool) *PlainHandler
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNoLoggerInContext = errors.New("no logger in context")
)
Functions ¶
func New ¶
func New(cfg LoggerConfig) *slog.Logger
Types ¶
type LoggerConfig ¶
type PlainHandler ¶
type PlainHandler struct {
// contains filtered or unexported fields
}
func NewPlainHandler ¶
func NewPlainHandler(w io.Writer, level slog.Leveler) *PlainHandler
func (*PlainHandler) WithSource ¶
func (h *PlainHandler) WithSource(b bool) *PlainHandler
func (*PlainHandler) WithTimestamp ¶
func (h *PlainHandler) WithTimestamp(b bool) *PlainHandler
Click to show internal directories.
Click to hide internal directories.