有什么方法可以使警告功能起作用吗?
func Warn(s string, args ...interface{}) {
log.Printf("warn: "+s, args)
}
func main() {
Warn("%d apples, %s ", 10, "good") //it should output the same as below
log.Printf("%d apples, %s ", 10, "good")
}
输出:
2009/11/10 23:00:00 warn: [10 %!d(string=good)] apples, %s(MISSING)
2009/11/10 23:00:00 10 apples, good
我正在努力使这项工作:http ://play.golang.org/p/W62f2NGDUe