1 package calldepth 2 3 import ( 4 "github.com/go-logr/logr" 5 ) 6 7 // Putting these functions into a separate file makes it possible to validate that 8 // their source code file is *not* logged because of WithCallDepth(1). 9 10 func myInfo(l logr.Logger, msg string) { 11 l.WithCallDepth(2).Info(msg) 12 } 13 14 func myInfo2(l logr.Logger, msg string) { 15 myInfo(l.WithCallDepth(2), msg) 16 } 17