Logging the filename
examples/logging-filename/logging_filename.go
package main import ( "log" ) func main() { log.Print("standard (default)") log.SetFlags(log.LstdFlags | log.Lshortfile) log.Print("standard + shortfile") log.SetFlags(log.LstdFlags | log.Llongfile) log.Print("standard + shortfile") log.SetFlags(log.Lshortfile) log.Print("shortfile") }
2020/04/10 09:16:07 standard (default) 2020/04/10 09:16:07 logging_filename.go:11: standard + shortfile 2020/04/10 09:16:07 /home/gabor/work/slides/golang/examples/logging-filename/logging_filename.go:14: standard + shortfile logging_filename.go:17: shortfile