The goframe framework offers rich debugging features implemented by the gdebug component.

    Debugging - 图1warning

    The so-called “debugging” methods mostly relate to the development environment, including stack and call chain information analysis, and performance is often not particularly high.

    Usage:

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

    API Documentation:

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

    Method List:

    1. func BinVersion() string
    2. func BinVersionMd5() string
    3. func Caller(skip ...int) (function string, path string, line int)
    4. func CallerDirectory() string
    5. func CallerFileLine() string
    6. func CallerFileLineShort() string
    7. func CallerFilePath() string
    8. func CallerFunction() string
    9. func CallerPackage() string
    10. func CallerWithFilter(filter string, skip ...int) (function string, path string, line int)
    11. func FuncName(f interface{}) string
    12. func FuncPath(f interface{}) string
    13. func GoroutineId() int
    14. func PrintStack(skip ...int)
    15. func Stack(skip ...int) string
    16. func StackWithFilter(filter string, skip ...int) string
    17. func StackWithFilters(filters []string, skip ...int) string
    18. func TestDataPath(names ...string) string

    Those familiar with PHP might understand this better, as some of these methods are actually similar to certain magic constants in PHP. CallerDirectory corresponds to __DIR__, CallerFilePath corresponds to __FILE__, and CallerFunction corresponds to __FUNCTION__.