package stacktrace
Import Path
go.uber.org/zap/internal/stacktrace (on go.dev)
Dependency Relation
imports 4 packages, and imported by one package
Involved Source Files
Package stacktrace provides support for gathering stack traces
efficiently.
Package-Level Type Names (total 3, all are exported)
Depth specifies how deep of a stack trace should be captured.
func Capture(skip int, depth Depth) *Stack
const First
const Full
Formatter formats a stack trace into a readable string representation.
b *buffer.Buffer
// whehther we've written at least one frame already
FormatFrame formats the given frame.
FormatStack formats all remaining frames in the provided stacktrace -- minus
the final runtime.main/runtime.goexit frame.
func NewFormatter(b *buffer.Buffer) Formatter
Stack is a captured stack trace.
frames *runtime.Frames
// program counters; always a subslice of storage
The size of pcs varies depending on requirements:
it will be one if the only the first frame was requested,
and otherwise it will reflect the depth of the call stack.
storage decouples the slice we need (pcs) from the slice we pool.
We will always allocate a reasonably large storage, but we'll use
only as much of it as we need.
Count reports the total number of frames in this stacktrace.
Count DOES NOT change as Next is called.
Free releases resources associated with this stacktrace
and returns it back to the pool.
Next returns the next frame in the stack trace,
and a boolean indicating whether there are more after it.
func Capture(skip int, depth Depth) *Stack
func (*Formatter).FormatStack(stack *Stack)
Package-Level Functions (total 3, all are exported)
Capture captures a stack trace of the specified depth, skipping
the provided number of frames. skip=0 identifies the caller of
Capture.
The caller must call Free on the returned stacktrace after using it.
NewFormatter builds a new Formatter.
Take returns a string representation of the current stacktrace.
skip is the number of frames to skip before recording the stack trace.
skip=0 identifies the caller of Take.
Package-Level Variables (only one, which is unexported)
Package-Level Constants (total 2, both are exported)
First captures only the first frame.
Full captures the entire call stack, allocating more
storage for it if needed.
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |