RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
创新互联GoFrame教程:GoFrame 功能调试-gdebug

GOframe​框架提供了丰富的调试功能,由​gdebug​组件实现。

所谓的“调试”方法大多数和开发环境有一定关系,包含堆栈和调用链信息分析,并且性能往往不是特别高。

使用方式:

import "github.com/gogf/gf/v2/debug/gdebug"

接口文档:

https://pkg.go.dev/github.com/gogf/gf/v2/debug/gdebug

方法列表:

func BinVersion() string
func BinVersionMd5() string
func Caller(skip ...int) (function string, path string, line int)
func CallerDirectory() string
func CallerFileLine() string
func CallerFileLineShort() string
func CallerFilePath() string
func CallerFunction() string
func CallerPackage() string
func CallerWithFilter(filter string, skip ...int) (function string, path string, line int)
func FuncName(f interface{}) string
func FuncPath(f interface{}) string
func GoroutineId() int
func PrintStack(skip ...int)
func Stack(skip ...int) string
func StackWithFilter(filter string, skip ...int) string
func StackWithFilters(filters []string, skip ...int) string
func TestDataPath(names ...string) string

熟悉PHP的同学可能比较好理解,这里某些方法其实和PHP的部分魔术常量功能一致。​CallerDirectory​对应​__DIR__​,​CallerFilePath​对应​__FILE__​,​CallerFunction​对应​__FUNCTION__​。


文章题目:创新互联GoFrame教程:GoFrame 功能调试-gdebug
文章起源:http://www.jxjierui.cn/article/dhhdccp.html