stacktrace

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package stacktrace provides you a StackTrace type that contains both the list of the runtime.Frame of the stacktrace, and the printed format fo debug.Stack(), so you can choose which format you want to use.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StackTrace

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

StackTrace wrap two information: - the stacktrace as a string from debug.Stack() - the list of the frames coming from runtime.Callers()

func New

func New() StackTrace

New builds a new StackTrace.

func (StackTrace) Frames

func (st StackTrace) Frames() []runtime.Frame

Frames return the list of runtime.Frame, built using runtime.Callers().

func (StackTrace) Last

func (st StackTrace) Last() (runtime.Frame, bool)

Last return the LastFrame outside the vendors and the go source files.

func (StackTrace) LastFrame

func (st StackTrace) LastFrame(ignoreGo bool, ignoredFiles ...string) (runtime.Frame, bool)

LastFrame will return the last frame in the stacktrace, ignoring go source files if ignoreGo is set to true, and ignoring files containing the strings provided in ignoredFiles. It can happen that all frames are ignored, so you need to check if LastFrame is returning true

func (StackTrace) String

func (st StackTrace) String() string

String returns the stacktrace as a string, with the same format as debug.Stack()

Jump to

Keyboard shortcuts

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