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

admin

这个人很懒,什么都没有留下~

Share
Published by
admin

Recent Posts

聊聊vue3中的defineProps

在Vue 3中,defineP…

1 周 ago

在 Chrome 中删除、允许和管理 Cookie

您可以选择删除现有 Cooki…

2 周 ago

自定义指令:聊聊vue中的自定义指令应用法则

今天我们来聊聊vue中的自定义…

3 周 ago

聊聊Vue中@click.stop和@click.prevent

一起来学下聊聊Vue中@cli…

4 周 ago

Nginx 基本操作:启动、停止、重启命令。

我们来学习Nginx基础操作:…

1 月 ago

Vue3:手动清理keep-alive组件缓存的方法

Vue3中手动清理keep-a…

1 月 ago