Skip to content

Commit

Permalink
Fix losing number of line when wrap the log function
Browse files Browse the repository at this point in the history
  • Loading branch information
lixin9311 committed Jun 28, 2018
1 parent 7358a5c commit b9cf96a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main.go
Expand Up @@ -23,9 +23,11 @@ var config struct {
UDPTimeout time.Duration
}

var logger = log.New(os.Stderr, "", log.Lshortfile|log.LstdFlags)

func logf(f string, v ...interface{}) {
if config.Verbose {
log.Printf(f, v...)
logger.Output(2, fmt.Sprintf(f, v...))
}
}

Expand Down

0 comments on commit b9cf96a

Please sign in to comment.