创新互联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://gydahua.com/article/dhhdccp.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流