package utils

import (
	"runtime"
	"time"
)

const (
	UID      = "uid"
	Module   = "module"
	FuncName = "funcName"
	FuncArgs = "funcArgs"
	FuncRsp  = "response"
	TimeCost = "timeCost"
)

//打印函数处理信息
// func TraceFunc(uid string, module string, funcName string, funcArgs interface{}, rsp interface{}) {
// 	log.Debugf("traceFunc uid:%s module:%s funcName:%s funcArgs:%v", uid, module, funcName, funcArgs)
// }

// 打印函数处理时间
func TraceTimeCost(funcName string, invocation time.Time) {
	elapsed := time.Since(invocation)
	cost := elapsed.Milliseconds()
	// lg := fmt.Sprintf("funcName:%s timeCost:%v", funcName, cost)

	if cost < 20 {

		return
	}

}

// 打印异常
func TraceError(err error) (b bool) {
	if err != nil {
		_, _, _, _ = runtime.Caller(1)
		b = true
	}
	return
}
