Go: internal/testlog Index | Files

package testlog

import "internal/testlog"

Package testlog provides a back-channel communication path between tests and package os, so that cmd/go can see which environment variables and files a test consults.

Index

Package Files

log.go

func Getenv Uses

func Getenv(name string)

Getenv calls Logger().Getenv, if a logger has been set.

func Open Uses

func Open(name string)

Open calls Logger().Open, if a logger has been set.

func SetLogger Uses

func SetLogger(impl Interface)

SetLogger sets the test logger implementation for the current process. It must be called only once, at process startup.

func Stat Uses

func Stat(name string)

Stat calls Logger().Stat, if a logger has been set.

type Interface Uses

type Interface interface {
    Getenv(key string)
    Stat(file string)
    Open(file string)
    Chdir(dir string)
}

Interface is the interface required of test loggers. The os package will invoke the interface's methods to indicate that it is inspecting the given environment variables or files. Multiple goroutines may call these methods simultaneously.

func Logger Uses

func Logger() Interface

Logger returns the current test logger implementation. It returns nil if there is no logger.

Package testlog imports 1 packages (graph) and is imported by 8 packages. Updated 2019-11-13. Refresh now. Tools for package owners.