stacktrace

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2017 License: Apache-2.0 Imports: 4 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 Entry

type Entry struct {
	// Location holds the physical location for this entry.
	Location Location
	// Location holds the logical location for this entry.
	Function Function
}

Entry holds the human understandable form of a StackTrace entry.

func Capture

func Capture() []Entry

Capture returns a full stacktrace.

func (Entry) String

func (e Entry) String() string

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.

func MatchPackage

func MatchPackage(pkg string) Matcher

MatchPackage returns a predicate that matches the specified package.

type Source

type Source func() []Entry

Source is the signature for something that returns a stacktrace.

func TrimBottom

func TrimBottom(match Matcher, source Source) Source

TrimBottom trims stack entries from the bottom of the trace. It trims from the first matching entry down to the end of the trace.

func TrimTop

func TrimTop(match Matcher, source Source) Source

TrimTop trims stack entries from the top of the trace. It trims from the last matching entry up to the start of the trace.

Jump to

Keyboard shortcuts

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