2024-04-09 10:17:08 +00:00
|
|
|
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...)
|
2024-04-15 09:01:42 +00:00
|
|
|
dlog.Debugln(out...)
|
2024-04-09 10:17:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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...)
|
2024-04-15 09:01:42 +00:00
|
|
|
dlog.Infoln(out...)
|
2024-04-09 10:17:08 +00:00
|
|
|
}
|