Golang log.Prefix and SetPrefix functions example
package log
Golang log.Prefix and SetPrefix functions usage example
package main
import (
"fmt"
"log"
)
func main() {
// Prefix add a string infront of the log message
fmt.Print(log.Prefix())
log.Println("Without prefix")
// Set our log prefix
log.SetPrefix("Log output: ")
fmt.Println(log.Prefix())
log.Println("With prefix")
}
Output :
2015/03/26 14:59:33 Without prefix
Log output:
Log output: 2015/03/26 14:59:33 With prefix
References :
Advertisement
Something interesting
Tutorials
+29.5k Golang : Login(Authenticate) with Facebook example
+13.7k Golang : Tutorial on loading GOB and PEM files
+8.1k Golang : How To Use Panic and Recover
+7.7k Golang : get the current working directory of a running program
+6.9k Android Studio : Hello World example
+8.9k Golang : Gaussian blur on image and camera video feed examples
+14.4k Android Studio : Use image as AlertDialog title with custom layout example
+27.2k Golang : Find files by name - cross platform example
+7.3k Golang : How to iterate a slice without using for loop?
+15.9k Golang : Get current time from the Internet time server(ntp) example