Skip to content

Commit

Permalink
fix: fix caller jump out
Browse files Browse the repository at this point in the history
  • Loading branch information
VarusHsu committed Feb 6, 2024
1 parent 00722ad commit 6d0cef9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions database.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ func defaultLogger(sql string, durationNano int64) {
var ok bool
for i := 0; i < 16; i++ {
_, file, line, ok = runtime.Caller(i)
// `strings.HasPrefix(file, srcPrefix)` jump out when using sqlingo as dependent package
// `!strings.HasPrefix(file, srcPrefix)` jump out when using sqlingo as dependent package
// `strings.HasSuffix(file, "_test.go")` jump out when executing unit test cases
// `!ok` this is so terrible for something unexpected happened
if !ok || strings.HasPrefix(file, srcPrefix) || strings.HasSuffix(file, "_test.go") {
if !ok || !strings.HasPrefix(file, srcPrefix) || strings.HasSuffix(file, "_test.go") {
break
}
}
Expand Down

0 comments on commit 6d0cef9

Please sign in to comment.