stacktrace

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2019 License: Apache-2.0 Imports: 5 Imported by: 21

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 added in v0.6.2

type Callstack []uintptr

Callstack is a full stacktrace

func Capture

func Capture() Callstack

Capture returns a full stacktrace.

func (Callstack) Entries added in v0.6.2

func (c Callstack) Entries() []Entry

Entries returns all the entries for the stack trace.

func (Callstack) Filter added in v0.6.2

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

Filter returns a new capture filtered by f.

func (Callstack) String added in v0.6.2

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 added in v0.6.2

type Filter func([]Entry) []Entry

Filter returns a filtered set of stack entries.

func And added in v0.6.2

func And(filters ...Filter) Filter

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

func Trim added in v0.6.2

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