MCPcopy Create free account
hub / github.com/docker/secrets-engine / stackTrace

Function stackTrace

x/logging/logging.go:90–108  ·  view source on GitHub ↗

Similar to debug.Stack() except it skips the top 3 frames which include the logger itself to keep the logs focused on the actual relevant stack traces.

()

Source from the content-addressed store, hash-verified

88// Similar to debug.Stack() except it skips the top 3 frames which include the logger itself
89// to keep the logs focused on the actual relevant stack traces.
90func stackTrace() string {
91 const depth = 32
92 var pcs [depth]uintptr
93 n := runtime.Callers(3, pcs[:]) // skip runtime.Callers + stackTrace
94 if len(pcs) < n {
95 return ""
96 }
97 frames := runtime.CallersFrames(pcs[:n])
98 trace := ""
99 for {
100 frame, more := frames.Next()
101 // Note: Additionally set -trimpath when building to not leak anything from the file path
102 trace += fmt.Sprintf("%s\n\t%s:%d\n", frame.Function, frame.File, frame.Line)
103 if !more {
104 break
105 }
106 }
107 return trace
108}
109
110type loggerKey struct{}
111

Callers 1

ErrorfMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected