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
+17.9k Golang : Simple client server example
+26.8k Golang : Find files by extension
+11.4k Golang : Concatenate (combine) buffer data example
+12.7k Golang : Add ASCII art to command line application launching process
+11.3k Golang : Post data with url.Values{}
+4.3k Javascript : How to show different content with noscript?
+36.3k Golang : Convert(cast) int64 to string
+29.1k Golang : Get first few and last few characters from string
+6.8k Get Facebook friends working in same company
+29.2k Golang : missing Git command
+14.5k Golang : Overwrite previous output with count down timer
+30.4k Golang : Generate random string