Files
troubleshoot/pkg/debug/log.go
2021-03-02 17:27:01 +00:00

29 lines
407 B
Go

package debug
import (
"log"
"os"
"github.com/spf13/viper"
)
var logger = log.New(os.Stderr, "[debug]", log.Lshortfile)
func Print(v ...interface{}) {
if viper.GetBool("debug") {
log.Print(v...)
}
}
func Printf(format string, v ...interface{}) {
if viper.GetBool("debug") {
log.Printf(format, v...)
}
}
func Println(v ...interface{}) {
if viper.GetBool("debug") {
log.Println(v...)
}
}