Golang log.Fatal function example

package log

Golang log.Fatal function usage example

 package main

 import (
 "fmt"
 "log"
 )

 func main() {

 fmt.Println("Before")

 // Fatal will cause the program to
 // terminate
 log.Fatal("die here!")

 fmt.Println("After")
 }

Output :

Before

2015/03/26 14:26:55 die here!

exit status 1

Reference :

http://golang.org/pkg/log/#Fatal

Advertisement