Golang log.New() function example
package log
Golang log.New() function usage example
package main
import (
"log"
"os"
)
func main() {
logger := log.New(os.Stdout, "", log.LstdFlags)
value := 25
logger.Fatalf("Value is %d \n", value)
}
Output :
2015/03/26 15:57:29 Value is 25
exit status 1
Reference :
Advertisement
Something interesting
Tutorials
+7k Golang : Levenshtein distance example
+5.8k Golang : List all packages and search for certain package
+6.1k Golang : How to write backslash in string?
+21.1k Golang : Get password from console input without echo or masked
+5.7k Linux/Unix/PHP : Restart PHP-FPM
+18.4k Golang : How to remove certain lines from a file
+14.5k Golang : Overwrite previous output with count down timer
+7.5k Golang : How to stop user from directly running an executable file?
+15.4k Golang : invalid character ',' looking for beginning of value
+4.1k Javascript : Empty an array example
+13.8k Generate salted password with OpenSSL example
+14k Golang : Fix cannot use buffer (type bytes.Buffer) as type io.Writer(Write method has pointer receiver) error