Golang log.Fatalln() function example

package log

Golang log.Fatalln() function usage example

 package main

 import (
 "fmt"
 "log"
 )

 func main() {

 fmt.Println("Before")

 value := 0.5

 // Fatalf will cause the program to
 // terminate
 // Fatalln is kinda similar to fmt.Println (with next line)
 log.Fatalln("value %f die here!", value)

 fmt.Println("After")
 }

Output :

Before

2015/03/26 14:34:37 value %f die here! 0.5

exit status 1

Reference :

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

Advertisement