MCPcopy Index your code
hub / github.com/coder/slog / fillLoc

Method fillLoc

slog.go:192–210  ·  view source on GitHub ↗
(skip int)

Source from the content-addressed store, hash-verified

190}
191
192func (ent SinkEntry) fillLoc(skip int) SinkEntry {
193 // Copied from testing.T
194 const maxStackLen = 50
195 var pc [maxStackLen]uintptr
196
197 // Skip two extra frames to account for this function
198 // and runtime.Callers itself.
199 n := runtime.Callers(skip+2, pc[:])
200 frames := runtime.CallersFrames(pc[:n])
201 for {
202 frame, more := frames.Next()
203 _, helper := helpers.Load(frame.Function)
204 if !helper || !more {
205 // Found a frame that wasn't a helper function.
206 // Or we ran out of frames to check.
207 return ent.fillFromFrame(frame)
208 }
209 }
210}
211
212func location(skip int) (file string, line int, fn string) {
213 pc, file, line, _ := runtime.Caller(skip + 1)

Callers 1

entryMethod · 0.95

Calls 1

fillFromFrameMethod · 0.95

Tested by

no test coverage detected