Documentation
¶
Index ¶
- func HookedLoggerBuilder(t testing.TB, hook func(ctx context.Context, r slog.Record)) func(*logger.LogConfiguration) (*slog.Logger, error)
- func LoggerBuilder(t testing.TB) func(*logger.LogConfiguration) (*slog.Logger, error)
- func NOP() *slog.Logger
- func New(t testing.TB) *slog.Logger
- func NewLoggerHook(h slog.Handler, hook func(ctx context.Context, r slog.Record)) *logHandler
- func NewLvl(t testing.TB, level slog.Level) *slog.Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HookedLoggerBuilder ¶
func HookedLoggerBuilder(t testing.TB, hook func(ctx context.Context, r slog.Record)) func(*logger.LogConfiguration) (*slog.Logger, error)
HookedLoggerBuilder creates logger which sends every log message also to "hook".
func LoggerBuilder ¶
LoggerBuilder returns "logger factory" for test t.
Factory function returned by LoggerBuilder returns the same logger for all calls.
func NOP ¶
NOP returns a logger which doesn't log (ie /dev/null). Use it for tests where valid logger is needed but it's output is not needed.
func NewLoggerHook ¶
func NewLvl ¶
NewLvl returns logger for test t on level "level".
First part of the log line is source location which is invalid for messages logged by the logger (they are correct for the t.Log, t.Error etc calls). Fix needs support from the Go testing lib (see https://github.com/golang/go/issues/59928).
Types ¶
This section is empty.