Golang have standard log package. Is there a way to put mircoseconds to its output?
Standard code puts pretty useless timestamp with second precision:
log.Println("Starting app on", APP_PORT)
2015/07/29 19:28:32 Starting app on :9090
Change the log flags to add microseconds. Available flags are there: http://golang.org/pkg/log/#pkg-constants
log.SetFlags(log.LstdFlags | log.Lmicroseconds)
log.Print("Hello, playground")
// 2009/11/10 23:00:00.000000 Hello, playground
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With