From 6d0cef9f040b8131e8968d244beda664fd0fff30 Mon Sep 17 00:00:00 2001 From: XuShuo Date: Tue, 6 Feb 2024 15:00:32 +0800 Subject: [PATCH] fix: fix caller jump out --- database.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database.go b/database.go index 8ed157f..5a29a0f 100644 --- a/database.go +++ b/database.go @@ -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 } }