package check import ( "time" "github.com/sirupsen/logrus" ) func TimeCost(name string) func() { start := time.Now() return func() { tc := time.Since(start) logrus.Infof("[%s]time cost = %v\n", name, tc) } }