Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Simple Logging

package main

import (
	"log"
)

func main() {
	log.Print("First log")
	log.Print("Each log line is on its own")
	log.Println("Despite its name it does not add any extra newline")
	log.Printf("Value: %v seen", 42)
}
2020/04/10 08:49:05 First log
2020/04/10 08:49:05 Each log line is on its own
2020/04/10 08:49:05 Despite its name it does not add any extra newline
2020/04/10 08:49:05 Value: 42 seen
  • By default log prints to STDERR (Standard Error)