Standard library / testing

testing.T.Log()

Record diagnostic text without marking failure. Passing test and fuzz logs are normally visible with -v; benchmark logging has its own reporting behavior. Expected process exit: 0; output contains ['PASS', 'diagnostic', 'body reached']. Run as a _test.go file using the Go test harness.

Formal Syntax & Structure

go syntaxgo
func (c *T) Log(args ...any)

Parameters & Attributes

NameTypeDescription
args...anyValues to format or log.

Working Example

Example Snippetgo
package main
import (  "fmt"  "testing")
func TestReference(t *testing.T) { t.Log("diagnostic"); fmt.Println("body reached") }
Go Reference