Skip to content

Commit

Permalink
Merge pull request #96 from lixin9311/better_log
Browse files Browse the repository at this point in the history
Fix losing number of line when wrap the log function
  • Loading branch information
riobard authored Jun 28, 2018
2 parents 7358a5c + b9cf96a commit ef4b562
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
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 ef4b562

Please sign in to comment.