Golang log.Flags function example
package log
Golang log.Flags function usage example
package main
import (
"fmt"
"log"
)
func main() {
fmt.Println("standard flags :", log.Flags())
// the flags constants
// see http://golang.org/pkg/log/#pkg-constants
fmt.Println("The date : ", log.Ldate)
fmt.Println("The time : ", log.Ltime)
fmt.Println("The microsecond resolution : ", log.Lmicroseconds)
fmt.Println("The full file name and line number : ", log.Llongfile)
fmt.Println("The final file name element and line number : ", log.Lshortfile)
fmt.Println("The initial values for the standard logger : ", log.LstdFlags) //LstdFlags = Ldate | Ltime
}
Output :
standard flags : 3
The date : 1
The time : 2
The microsecond resolution : 4
The full file name and line number : 8
The final file name element and line number : 16
The initial values for the standard logger : 3
References :
http://golang.org/pkg/log/#pkg-constants http://golang.org/pkg/log/#Flags
Advertisement
Something interesting
Tutorials
+10.9k Nginx : TLS 1.2 support
+6.5k Golang : Spell checking with ispell example
+25.3k Golang : Get current file path of a file or executable
+7.4k Linux : How to fix Brother HL-1110 printing blank page problem
+5.2k Golang : Issue HTTP commands to server and port example
+11k Golang : Replace a parameter's value inside a configuration file example
+11.7k Golang : Secure file deletion with wipe example
+8.1k Golang : Append and add item in slice
+5k Golang : Get a list of crosses(instruments) available to trade from Oanda account
+15.8k Golang : Get digits from integer before and after given position example
+4.8k Facebook : How to place save to Facebook button on your website