mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
improve debugging feature
This commit is contained in:
@ -14,8 +14,6 @@ import (
|
||||
"reflect"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/gogf/gf/v2/internal/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -35,7 +33,7 @@ func init() {
|
||||
goRootForFilter = strings.Replace(goRootForFilter, "\\", "/", -1)
|
||||
}
|
||||
// Initialize internal package variable: selfPath.
|
||||
selfPath, _ := exec.LookPath(os.Args[0])
|
||||
selfPath, _ = exec.LookPath(os.Args[0])
|
||||
if selfPath != "" {
|
||||
selfPath, _ = filepath.Abs(selfPath)
|
||||
}
|
||||
@ -69,7 +67,7 @@ func CallerWithFilter(filter string, skip ...int) (function string, path string,
|
||||
pc, file, line, ok = runtime.Caller(i)
|
||||
}
|
||||
if ok {
|
||||
function := ""
|
||||
function = ""
|
||||
if fn := runtime.FuncForPC(pc); fn == nil {
|
||||
function = "unknown"
|
||||
} else {
|
||||
@ -102,14 +100,8 @@ func callerFromIndex(filters []string) (pc uintptr, file string, line int, index
|
||||
if filtered {
|
||||
continue
|
||||
}
|
||||
if !utils.IsDebugEnabled() {
|
||||
if strings.Contains(file, utils.StackFilterKeyForGoFrame) {
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
if strings.Contains(file, stackFilterKey) {
|
||||
continue
|
||||
}
|
||||
if strings.Contains(file, stackFilterKey) {
|
||||
continue
|
||||
}
|
||||
if index > 0 {
|
||||
index--
|
||||
|
||||
@ -11,8 +11,6 @@ import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/gogf/gf/v2/internal/utils"
|
||||
)
|
||||
|
||||
// PrintStack prints to standard error the stack trace returned by runtime.Stack.
|
||||
@ -82,14 +80,8 @@ func StackWithFilters(filters []string, skip ...int) string {
|
||||
continue
|
||||
}
|
||||
|
||||
if !utils.IsDebugEnabled() {
|
||||
if strings.Contains(file, utils.StackFilterKeyForGoFrame) {
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
if strings.Contains(file, stackFilterKey) {
|
||||
continue
|
||||
}
|
||||
if strings.Contains(file, stackFilterKey) {
|
||||
continue
|
||||
}
|
||||
|
||||
if fn := runtime.FuncForPC(pc); fn == nil {
|
||||
|
||||
Reference in New Issue
Block a user