Standard library / log

log.Println()

Write a line using space-separated operands. Expected stdout: 'a b\n'.

Formal Syntax & Structure

go syntaxgo
func Println(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.Println("a", "b")  fmt.Print(b.String())}
Go Reference