testlog

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: GPL-3.0, LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package testlog provides utilities for logging test output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogCommand

func LogCommand(t *testing.T, msg string, cmd *exec.Cmd)

LogCommand logs the given command to stderr.

func LogEndSeparator

func LogEndSeparator(t *testing.T, args ...any)

LogEndSeparator logs a separator to stderr with the given message.

func LogEndSeparatorf

func LogEndSeparatorf(t *testing.T, s string, args ...any)

LogEndSeparatorf logs a separator to stderr with the given formatted message.

func LogRedEndSeparator

func LogRedEndSeparator(t *testing.T, args ...any)

LogRedEndSeparator logs a separator to stderr with the given message in red.

func LogRedEndSeparatorf

func LogRedEndSeparatorf(t *testing.T, s string, args ...any)

LogRedEndSeparatorf logs a separator to stderr with the given formatted message in red.

func LogStartSeparator

func LogStartSeparator(t *testing.T, args ...any)

LogStartSeparator logs a separator to stderr with the given message.

func LogStartSeparatorf

func LogStartSeparatorf(t *testing.T, s string, args ...any)

LogStartSeparatorf logs a separator to stderr with the given formatted message.

func RunWithTiming

func RunWithTiming(t *testing.T, msg string, cmd *exec.Cmd, options ...RunWithTimingOption) error

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.

Jump to

Keyboard shortcuts

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