HomeToolsAbout a20k

Console

Print Statement

fmt.Println is used for debugging purposes

import "fmt" fmt.Println("debug message") // string interpolation name := "Sam" fmt.Sprintf("Hi, my name is %v", name)

Printf prints the string Sprintf creates string and returns it

Logging

log.Println is used for logging purposes

import "log" log.Println("debug message")

Log Levels

  • log.Fatal - logs the message and calls os.Exit(1)
  • log.Panic - logs the message and calls panic
  • log.Print - logs the message
© VincentVanKoh