testUtils

package
v0.0.0-...-3ff763c Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2016 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReTimestamp = regexp.MustCompile(`^\d{4}-\d\d-\d\d \d\d:\d\d:\d\d\.\d{3}`)

ReTimestamp is used for replacing actual timestamps from detailed logging output to a testable string instead.

Functions

func LogMsgs

func LogMsgs()

LogMsgs logs sample messages to logrus.

func ResetLogger

func ResetLogger(logger ...*logrus.Logger)

ResetLogger re-initializes the global logrus logger so stdout/stderr changes are applied to it. Otherwise after patching the streams logrus still points to the original file descriptor.

func WithCapSys

func WithCapSys(function func()) (string, string, error)

WithCapSys temporarily redirects stdout/stderr pipes to capture the output while the function runs. Returns them as strings.

func WithLogging

func WithLogging(function func()) (hook *test.Hook, stdout, stderr string, err error)

WithLogging wraps around WithCapSys(). It enables a test debug logger before calling the input function.

Types

This section is empty.

Jump to

Keyboard shortcuts

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