9951 explained code solutions for 126 technologies


golangHow to log errors


Errors can be logged as simply as:

package main
import ( "log"; "errors" )

func main() {
  log.Println(errors.New("oops"))
}ctrl + c
package main

default package declaration

func main() {

declare main function that will be launched automatically

log.Println(

write given message to log

errors.New(

creates new error object