package common import ( "fmt" "time" "linkfog.com/public/lib/l" ) func TimeCost(describe string) func() { start := time.Now() return func() { tc := time.Since(start) l.Infof(describe+" cost %v", tc) } } // Deprecated invalid usage func TimeCostString(describe string) func() string { start := time.Now() return func() string { tc := time.Since(start) return fmt.Sprintf(describe+" cost %v", tc) } } func TimeCostDebug(describe string) func() { start := time.Now() return func() { tc := time.Since(start) l.Debugf(describe+" cost %v", tc) } }