update
This commit is contained in:
parent
02cdc3c792
commit
e52d67cfe3
@ -11,6 +11,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.zhangdeman.cn/zhangdeman/exception"
|
"git.zhangdeman.cn/zhangdeman/exception"
|
||||||
@ -109,10 +111,28 @@ func SendWithException(ctx *gin.Context, e exception.IException, data any) {
|
|||||||
e = exception.NewSuccess(data)
|
e = exception.NewSuccess(data)
|
||||||
}
|
}
|
||||||
if !define.GetHttpHandleConfig().DisableDebugStackOutput {
|
if !define.GetHttpHandleConfig().DisableDebugStackOutput {
|
||||||
pc, file, line, ok := runtime.Caller(1)
|
pcs := make([]uintptr, 128)
|
||||||
if ok {
|
n := runtime.Callers(2, pcs)
|
||||||
fmt.Println(runtime.FuncForPC(pc).Name(), file, line)
|
|
||||||
|
frames := runtime.CallersFrames(pcs[:n])
|
||||||
|
|
||||||
|
var sb strings.Builder
|
||||||
|
for {
|
||||||
|
frame, more := frames.Next()
|
||||||
|
|
||||||
|
sb.WriteString(frame.Function)
|
||||||
|
sb.WriteByte('\n')
|
||||||
|
sb.WriteByte('\t')
|
||||||
|
sb.WriteString(frame.File)
|
||||||
|
sb.WriteByte(':')
|
||||||
|
sb.WriteString(strconv.Itoa(frame.Line))
|
||||||
|
sb.WriteByte('\n')
|
||||||
|
|
||||||
|
if !more {
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
fmt.Println(sb.String())
|
||||||
}
|
}
|
||||||
outputData := map[string]any{
|
outputData := map[string]any{
|
||||||
"e_data": e.GetData(),
|
"e_data": e.GetData(),
|
||||||
|
Loading…
Reference in New Issue
Block a user