Standard library / log

log.Print()

Write a line using fmt.Print-style formatting. Expected stdout: 'hello\n'.

Formal Syntax & Structure

go syntaxgo
func Print(v ...any)

Parameters & Attributes

NameTypeDescription
v...anyValues to log or convert.

Working Example

Example Snippetgo
package main
import (  "bytes"  "fmt"  "log")
func main() {  var b bytes.Buffer  log.SetOutput(&b)  log.SetFlags(0)  log.SetPrefix("")  log.Print("hello")  fmt.Print(b.String())}
Go Reference