log: add LogFunc so we can define a custom logger

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

No files matched your search

+16
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...)
}
}
}
-6
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