GoFrame 功能调试-gdebug

2022-04-12 11:06 更新

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__​。


以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号