stacktrace

package
v0.0.0-...-7a622f3 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package stacktrace has functionality for capturing and printing stack traces. It also has support for adding stack track capturing that is triggered when a Note is created.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callstack

type Callstack []uintptr

Callstack is a full stacktrace

func Capture

func Capture() Callstack

Capture returns a full stacktrace.

func (Callstack) Entries

func (c Callstack) Entries() []Entry

Entries returns all the entries for the stack trace.

func (Callstack) Filter

func (c Callstack) Filter(f ...Filter) Callstack

Filter returns a new capture filtered by f.

func (Callstack) String

func (c Callstack) String() string

type Entry

type Entry struct {
	// Location holds the physical location for this entry.
	Location Location
	// Location holds the logical location for this entry.
	Function Function
	// PC is the program counter for this entry.
	PC uintptr
}

Entry holds the human understandable form of a StackTrace entry.

func (Entry) String

func (e Entry) String() string

type Filter

type Filter func([]Entry) []Entry

Filter returns a filtered set of stack entries.

func And

func And(filters ...Filter) Filter

And returns a filter where all of the filters need to pass.

func Trim

func Trim(m Matcher) Filter

Trim returns a filter combining the TrimTop and TrimBottom filters with m.

func TrimBottom

func TrimBottom(m Matcher) Filter

TrimBottom returns a filter that removes all the shallowest entries that doesn't satisfy m.

func TrimTop

func TrimTop(m Matcher) Filter

TrimTop returns a filter that removes all the deepest entries that doesn't satisfy m.

type Function

type Function struct {
	// Package is the go package the stack entry is from.
	Package string
	// Name is the function name the stack entry is from.
	Name string
}

Function holds the logical location of a stack entry.

func (Function) String

func (f Function) String() string

type Location

type Location struct {
	// Directory is the directory the source file is from.
	Directory string
	// File is the filename of the source file.
	File string
	// Line is the line index in the file.
	Line int
}

Location holds the physical location of a stack entry.

func (Location) String

func (l Location) String() string

type Matcher

type Matcher func(Entry) bool

Matcher is a predicate for stack entries.

func MatchFunction

func MatchFunction(fun string) Matcher

MatchFunction returns a predicate that matches the specified function by regular expression.

func MatchPackage

func MatchPackage(pkg string) Matcher

MatchPackage returns a predicate that matches the specified package by regular expression.

Directories

Path Synopsis
Package crunch provides functions to compress and decompress stacktraces.
Package crunch provides functions to compress and decompress stacktraces.

Jump to

Keyboard shortcuts

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