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
+10.9k Golang : How to transmit update file to client by HTTP request example
+4.8k Golang : A program that contain another program and executes it during run-time
+20.9k Golang : Underscore or snake_case to camel case example
+5.2k Golang : Calculate half life decay example
+12.2k Linux : How to install driver for 600Mbps Dual Band Wifi USB Adapter
+12.7k Android Studio : Highlight ImageButton when pressed on example
+8.3k Swift : Convert (cast) Character to Integer?
+12.1k Golang : Save webcamera frames to video file
+31.5k Golang : Example for ECDSA(Elliptic Curve Digital Signature Algorithm) package functions
+30.9k Golang : Interpolating or substituting variables in string examples
+13.6k Golang : Get user input until a command or receive a word to stop
+51.4k Golang : Check if item is in slice/array