增加调用堆栈的获取

This commit is contained in:
2022-10-15 00:57:39 +08:00
parent e37a26f4ad
commit 2bee255fcf
3 changed files with 41 additions and 1 deletions

21
trace.go Normal file
View File

@ -0,0 +1,21 @@
// Package trace ...
//
// Description : trace ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2022-10-15 00:37
package trace
import "runtime"
// GetTraceFileInfo 获取文件 trace 信息
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 00:44 2022/10/15
func GetTraceFileInfo(offset int) CallStack {
stack := CallStack{}
_, stack.FilePath, stack.LineNo, _ = runtime.Caller(offset)
return stack
}