diff --git a/spanlogger/spanlogger_test.go b/spanlogger/spanlogger_test.go index 641c583b6..70ab9ec36 100644 --- a/spanlogger/spanlogger_test.go +++ b/spanlogger/spanlogger_test.go @@ -5,6 +5,7 @@ import ( "context" "fmt" "io" + "path/filepath" "runtime" "strings" "testing" @@ -296,7 +297,7 @@ func TestSpanLogger_CallerInfo(t *testing.T) { } func toCallerInfo(path string, lineNumber int) string { - fileName := path[strings.LastIndex(path, "/")+1:] + fileName := filepath.Base(path) return fmt.Sprintf("%s:%v", fileName, lineNumber) }