log: add LogFunc so we can define a custom logger

This commit is contained in:
nadoo 2017-08-23 18:04:20 +08:00
parent cba2f36b08
commit 65f33beaa3
2 changed files with 16 additions and 6 deletions

16
log.go Normal file
View File

@ -0,0 +1,16 @@
package main
import "log"
// LogFunc .
type LogFunc func(f string, v ...interface{})
var logf LogFunc
func init() {
logf = func(f string, v ...interface{}) {
if conf.Verbose {
log.Printf(f, v...)
}
}
}

View File

@ -11,12 +11,6 @@ import (
// VERSION .
const VERSION = "0.4.0"
func logf(f string, v ...interface{}) {
if conf.Verbose {
log.Printf(f, v...)
}
}
func dialerFromConf() Dialer {
// global forwarders in xx.conf
var forwarders []Dialer