19 lines
295 B
Go
19 lines
295 B
Go
package utils
|
|
|
|
import "fmt"
|
|
|
|
type Debug func(format string, v ...interface{})
|
|
|
|
var hookPrint = func(input string) {
|
|
fmt.Println(input)
|
|
}
|
|
|
|
func Init(flag string, enable bool) Debug {
|
|
|
|
return func(format string, v ...interface{}) {
|
|
if enable {
|
|
hookPrint(fmt.Sprintf(format, v...))
|
|
}
|
|
}
|
|
}
|