GoFrame 功能調(diào)試-gdebug

2022-04-12 11:06 更新

?goframe?框架提供了豐富的調(diào)試功能,由?gdebug?組件實(shí)現(xiàn)。

所謂的“調(diào)試”方法大多數(shù)和開發(fā)環(huán)境有一定關(guān)系,包含堆棧和調(diào)用鏈信息分析,并且性能往往不是特別高。

使用方式:

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的同學(xué)可能比較好理解,這里某些方法其實(shí)和PHP的部分魔術(shù)常量功能一致。?CallerDirectory?對應(yīng)?__DIR__?,?CallerFilePath?對應(yīng)?__FILE__?,?CallerFunction?對應(yīng)?__FUNCTION__?。


以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號