slogtest

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RemoveTime

func RemoveTime(groups []string, a slog.Attr) slog.Attr

RemoveTime removes the top-level time attribute. It is intended to be used as a ReplaceAttr function, to make example output deterministic.

This is taken from slog/internal/slogtest.RemoveTime.

func TestContextWithLogger

func TestContextWithLogger(t Logger) context.Context

TestContextWithLogger returns a context with a logger to be used in tests

func TestLogger

func TestLogger(t Logger) *clog.Logger

TestLogger gets a logger to use in unit and end to end tests

Types

type Logger

type Logger interface {
	Log(args ...any)
	Logf(format string, args ...any)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL