Documentation
¶
Overview ¶
Package testlog provides utilities for logging test output.
Index ¶
- func LogCommand(t *testing.T, msg string, cmd *exec.Cmd)
- func LogEndSeparator(t *testing.T, args ...any)
- func LogEndSeparatorf(t *testing.T, s string, args ...any)
- func LogRedEndSeparator(t *testing.T, args ...any)
- func LogRedEndSeparatorf(t *testing.T, s string, args ...any)
- func LogStartSeparator(t *testing.T, args ...any)
- func LogStartSeparatorf(t *testing.T, s string, args ...any)
- func RunWithTiming(t *testing.T, msg string, cmd *exec.Cmd, options ...RunWithTimingOption) error
- type RunWithTimingOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogCommand ¶
LogCommand logs the given command to stderr.
func LogEndSeparator ¶
LogEndSeparator logs a separator to stderr with the given message.
func LogEndSeparatorf ¶
LogEndSeparatorf logs a separator to stderr with the given formatted message.
func LogRedEndSeparator ¶
LogRedEndSeparator logs a separator to stderr with the given message in red.
func LogRedEndSeparatorf ¶
LogRedEndSeparatorf logs a separator to stderr with the given formatted message in red.
func LogStartSeparator ¶
LogStartSeparator logs a separator to stderr with the given message.
func LogStartSeparatorf ¶
LogStartSeparatorf logs a separator to stderr with the given formatted message.
func RunWithTiming ¶
RunWithTiming runs the given command while logging its duration with the provided message.
Types ¶
type RunWithTimingOption ¶
type RunWithTimingOption func(options *runWithTimingOptions)
RunWithTimingOption is a function that configures the RunWithTiming function.
func DoNotSetStdoutAndStderr ¶
func DoNotSetStdoutAndStderr() RunWithTimingOption
DoNotSetStdoutAndStderr prevents RunWithTiming from setting the stdout and stderr of the given command. By default, RunWithTiming sets stdout and stderr to the test's output.
func OnlyPrintStdoutAndStderrOnError ¶
func OnlyPrintStdoutAndStderrOnError() RunWithTimingOption
OnlyPrintStdoutAndStderrOnError makes RunWithTiming only print the stdout and stderr of the given command if it fails.