@@ -174,8 +174,8 @@ const calldepth = 3
174174
175175// callsite returns the file name and line number of the callsite to the
176176// subsystem logger.
177- func callsite (flag uint32 ) (string , int ) {
178- _ , file , line , ok := runtime .Caller (calldepth )
177+ func callsite (flag uint32 , skipDepth int ) (string , int ) {
178+ _ , file , line , ok := runtime .Caller (skipDepth )
179179 if ! ok {
180180 return "???" , 0
181181 }
@@ -204,7 +204,7 @@ func (b *Backend) print(lvl, tag string, args ...any) {
204204 var file string
205205 var line int
206206 if b .flag & (Lshortfile | Llongfile ) != 0 {
207- file , line = callsite (b .flag )
207+ file , line = callsite (b .flag , calldepth )
208208 }
209209
210210 formatHeader (bytebuf , t , lvl , tag , file , line )
@@ -231,7 +231,7 @@ func (b *Backend) printf(lvl, tag string, format string, args ...any) {
231231 var file string
232232 var line int
233233 if b .flag & (Lshortfile | Llongfile ) != 0 {
234- file , line = callsite (b .flag )
234+ file , line = callsite (b .flag , calldepth )
235235 }
236236
237237 formatHeader (bytebuf , t , lvl , tag , file , line )
0 commit comments