Documentation
¶
Overview ¶
Package flog provides slog helpers shared by various FerretDB projects.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewConsoleHandler ¶
func NewConsoleHandler(out io.Writer, opts *NewConsoleHandlerOpts) slog.Handler
NewConsoleHandler creates a new console handler.
If out is a valid tty, the consoleHandler will send colorized messages. If NO_COLOR environment variable is set colorized messages are disabled.
func TestingLogger ¶
func TestingLogger(tl TestingLog, level slog.Leveler) *slog.Logger
TestingLogger returns a slog test logger for the given level (which might be dynamic).
func TestingOutput ¶
func TestingOutput(tl TestingLog) io.Writer
TestingOutput returns a new io.Writer for testing.TB.
It should not be used once https://github.com/golang/go/issues/59928 is resolved (probably in Go 1.25).
Types ¶
type NewConsoleHandlerOpts ¶
type NewConsoleHandlerOpts struct {
Level slog.Leveler
RemoveTime bool
RemoveLevel bool
RemoveSource bool
}
NewConsoleHandlerOpts represents NewConsoleHandler options.
type TestingLog ¶
type TestingLog interface {
Helper()
Log(args ...any)
}
TestingLog is a subset of testing.TB. It is used to avoid importing the testing package.