代码拉取完成,页面将自动刷新
package log
//const (
// maximumCallerDepth int = 25
// knownLoggingFrames int = 4
//)
//var (
// callerInitOnce sync.Once
// loggerPackage string
// minimumCallerDepth int
//)
//func getCaller() *runtime.Frame {
// // cache this package's fully-qualified name
// callerInitOnce.Do(func() {
// pcs := make([]uintptr, maximumCallerDepth)
// _ = runtime.Callers(0, pcs)
//
// // dynamic get the package name and the minimum caller depth
// for i := 0; i < maximumCallerDepth; i++ {
// funcName := runtime.FuncForPC(pcs[i]).Name()
// if strings.Contains(funcName, "getCaller") {
// loggerPackage = getPackageName(funcName)
// break
// }
// }
//
// minimumCallerDepth = knownLoggingFrames
// })
//
// // Restrict the lookback frames to avoid runaway lookups
// pcs := make([]uintptr, maximumCallerDepth)
// depth := runtime.Callers(minimumCallerDepth, pcs)
// frames := runtime.CallersFrames(pcs[:depth])
//
// for f, again := frames.Next(); again; f, again = frames.Next() {
// pkg := getPackageName(f.Function)
//
// // If the caller isn't part of this package, we're done
// if pkg != loggerPackage {
// return &f //nolint:scopelint
// }
// }
//
// // if we got here, we failed to find the caller's context
// return nil
//}
//
//func getPackageName(f string) string {
// for {
// lastPeriod := strings.LastIndex(f, ".")
// lastSlash := strings.LastIndex(f, "/")
// if lastPeriod > lastSlash {
// f = f[:lastPeriod]
// } else {
// break
// }
// }
// return f
//}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。