Go: Line No. and File Name in Logs
I use this to log errors with more contextual information.
Just:
Llongfile // full file name and line number: /a/b/c/d.go:23
Lshortfile // final file name element and line number: d.go:23. overrides Llongfile
log.setFlags(log.Lshortfile)
Written by Adnaan Badr
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Golang
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#