Standard library / testing

testing.F.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 *F) Log(args ...any)

Parameters & Attributes

NameTypeDescription
args...anyValues to format or log.

Working Example

Example Snippetgo
package main
import (  "fmt"  "testing")
func FuzzReference(f *testing.F) {  f.Log("diagnostic")  fmt.Println("body reached")  f.Add("demo")  f.Fuzz(func(t *testing.T, s string) {    if s != "demo" {      t.Fatal(s)    }  })}
Go Reference