Golang log.Fatalf() function example
package log
Golang log.Fatalf() function usage example
package main
import (
"fmt"
"log"
)
func main() {
fmt.Println("Before")
value := 0.5
// Fatalf will cause the program to
// terminate
// Fatalf is kinda similar to fmt.Printf
log.Fatalf("value %f die here!", value)
fmt.Println("After")
}
Output :
Before
2015/03/26 14:32:32 value 0.500000 die here!
exit status 1
Reference :
Advertisement
Something interesting
Tutorials
+6.6k Golang : Embedded or data bundling example
+9.1k Golang : Handle sub domain with Gin
+8.9k Golang : What is the default port number for connecting to MySQL/MariaDB database ?
+19.2k Golang : Populate dropdown with html/template example
+11.3k Golang : Intercept and process UNIX signals example
+17.6k Golang : Parse date string and convert to dd-mm-yyyy format
+23.5k Golang : Get ASCII code from a key press(cross-platform) example
+7.9k Javascript : Put image into Chrome browser's console
+6k Linux/MacOSX : Search for files by filename and extension with find command
+17.6k Golang : Upload/Receive file progress indicator
+10.7k Golang : Underscore string example
+12.5k Golang : Forwarding a local port to a remote server example