创新互联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.shufengxianlan.com/qtweb/news24/381474.html

网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联