Vestmore_GO/utils/log/log_time.go

29 lines
566 B
Go

package log
import (
"fmt"
"time"
)
// 跟踪时间
func DebuglnTrackTime(do func(), fargs ...interface{}) {
now := time.Now()
do()
var t interface{} = fmt.Sprintf("[%dms]", time.Since(now).Milliseconds())
var out []interface{}
out = append(out, t)
out = append(out, fargs...)
dlog.Debugln(out...)
}
func InfolnTrackTime(do func(), fargs ...interface{}) {
now := time.Now()
do()
var t interface{} = fmt.Sprintf("[%dms]", time.Since(now).Milliseconds())
var out []interface{}
out = append(out, t)
out = append(out, fargs...)
dlog.Infoln(out...)
}