improve gerror for stack information; fix issue in gconv.String for nil *time.Time type

This commit is contained in:
John
2019-11-21 21:49:00 +08:00
parent 1deb3510f0
commit 382356bc8d
5 changed files with 59 additions and 1 deletions

View File

@ -9,6 +9,7 @@ package gerror
import (
"bytes"
"fmt"
"github.com/gogf/gf/internal/intlog"
"io"
"runtime"
"strings"
@ -22,7 +23,7 @@ type Error struct {
}
const (
gFILTER_KEY = "github.com/gogf/gf/"
gFILTER_KEY = "/errors/gerror/gerror"
)
var (
@ -130,6 +131,19 @@ func formatSubStack(st stack, buffer *bytes.Buffer) {
if strings.Contains(file, gFILTER_KEY) {
continue
}
if !intlog.IsInGFDevelop() {
// Avoid GF stacks if not in GF development.
if strings.Contains(file, "github.com/gogf/gf/") {
continue
}
if strings.Contains(file, "github.com/gogf/gf@") {
continue
}
}
// Avoid stack string like "<autogenerated>"
if strings.Contains(file, "<") {
continue
}
if goRootForFilter != "" && len(file) >= len(goRootForFilter) && file[0:len(goRootForFilter)] == goRootForFilter {
continue
}