From 9dbee70d2ad0d840e8bd96081e8acf995f9b318a Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Thu, 7 Jul 2022 14:09:09 -0400 Subject: [PATCH] Try different approach to omit the gorm files --- gorm.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gorm.go b/gorm.go index 88e119f..16a9f88 100644 --- a/gorm.go +++ b/gorm.go @@ -168,9 +168,12 @@ func displayLog(level LogLevel, stackLevel int, message string, params ...interf // Copied method in order to not make GORM a dependency of the project for this tiny utility method func fileWithLineNum() string { // the first & second caller usually from gorm internal, so set index start from 3 - for i := 3; i < 15; i++ { + for i := 2; i < 15; i++ { _, file, line, ok := runtime.Caller(i) - if ok && (!strings.HasPrefix(file, gormSourceDir) || strings.HasSuffix(file, "_test.go")) { + if ok && (!strings.HasPrefix(file, gormSourceDir) || + strings.HasSuffix(file, "_test.go") || + strings.HasSuffix(file, "callback.go") || + strings.HasSuffix(file, "finisher_api.go")) { return file + ":" + strconv.FormatInt(int64(line), 10) } }