stacktrace

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDepth = 64

Variables

This section is empty.

Functions

func WriteFrameToBuffer

func WriteFrameToBuffer(f runtime.Frame, b *strings.Builder)

WriteFrameToBuffer writes a string representation of the given runtime.Frame to the provided strings.Builder.

The format is:

	FunctionName
     FilePath:LineNumber

Types

type Stack

type Stack struct {
	// contains filtered or unexported fields
}

func Capture

func Capture(skip, depth int) *Stack

Capture captures the current stack trace, skipping the specified number of frames and limiting the depth of the trace. If depth is math.MaxInt, it captures the full trace.

func NewStack

func NewStack(initialSize int) *Stack

func (*Stack) AddCaller

func (s *Stack) AddCaller()

AddCaller adds the caller's frame to the stack.

func (*Stack) AddFrame

func (s *Stack) AddFrame(f runtime.Frame)

func (*Stack) FramesIter

func (s *Stack) FramesIter() iter.Seq2[int, runtime.Frame]

FramesIter returns an iterator over the frames in the stack.

The iterator yields the frames starting from uppermost (the one added last).

func (*Stack) Len

func (s *Stack) Len() int

Len returns amount of frames contained in stack.

func (*Stack) String

func (s *Stack) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL