Documentation
¶
Overview ¶
Package stack provides support for capturing stack traces efficiently.
It is a simplification of the zap package's internal implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Formatter ¶
type Formatter struct {
// contains filtered or unexported fields
}
Formatter is responsible for formatting a stack trace into a readable string representation.
func NewFormatter ¶
NewFormatter returns a new Formatter.
func (*Formatter) FormatFrame ¶
FormatFrame formats the given frame, appending it to the buffer.
func (*Formatter) FormatStack ¶
FormatStack formats all remaining frames in the given Stack (excl. final runtime.main/runtime.goexit frame), appending them to the buffer.
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
Stack is a captured stack trace.
A Stack is intended to be constructed via a sync.Pool using Capture.
func Capture ¶
Capture captures a stack trace, skipping the given number of frames.
When skip is zero, this will identify the caller of Capture.
The caller must call Stack.Free on the returned Stack after using it to ensure that it's resources are released, and it's returned to a sync.Pool.
func (*Stack) Free ¶
func (s *Stack) Free()
Free releases resources associated with the Stack and returns it to a sync.Pool.
Callers must not retain references to the Stack after calling Free.