When using the log.Lshortfile
flag, the logger prefixes all log lines with the file name and line number of the logger function call, for example:
myfile.go:14: Hello, world!
If I wrap the log function like this, for instance:
func info(pattern string, args ...interface{}) {
myLogger.Printf(pattern + "
", args...)
}
Every line emitted by this function is going to be prefixed with the line number of the Printf
call. That is as expected, but the desired behavior is for each line to be prefixed with the line number of the line where info
is called.
Is there any way around it?