stacktracez

package module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 6 Imported by: 2

README

gopherz

ezpkg.io/stacktracez

PkgGoDev GitHub License version

Package stacktracez provides functions for getting stack trace for using in errors and logs.

Installation

go get -u ezpkg.io/stacktracez@v0.2.2

Examples

stack := stacktracez.StackTrace()

fmt.Printf("%+v", stack)
// ezpkg.io/stacktracez.TestStackTrace.func1
// /Users/i/ws/ezpkg/ezpkg/stacktracez/stacktracez_test.go:12
// ezpkg.io/stacktracez.TestStackTrace
// /Users/i/ws/ezpkg/ezpkg/stacktracez/stacktracez_test.go:15
// testing.tRunner
// /usr/local/go/src/testing/testing.go:1689

fmt.Printf("%v", stack)
// ezpkg.io/stacktracez/stacktracez_test.go:12 · TestStackTrace.func1
// ezpkg.io/stacktracez/stacktracez_test.go:15 · TestStackTrace
// testing/testing.go:1689 · tRunner

Similar Packages

About ezpkg.io

As I work on various Go projects, I often find myself creating utility functions, extending existing packages, or developing packages to solve specific problems. Moving from one project to another, I usually have to copy or rewrite these solutions. So I created this repository to have all these utilities and packages in one place. Hopefully, you'll find them useful as well.

For more information, see the main repository.

Author

Oliver Nguyen  github

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Frame

type Frame runtime.Frame

func (Frame) Components added in v0.1.0

func (f Frame) Components() (pkg, file string, line int, fn string)

func (Frame) Format

func (f Frame) Format(s0 fmt.State, verb rune)

type Frames

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

func StackTrace

func StackTrace() *Frames

func StackTraceSkip

func StackTraceSkip(skip int) *Frames

func (*Frames) Format

func (fz *Frames) Format(s0 fmt.State, verb rune)

func (*Frames) GetFrames

func (fz *Frames) GetFrames() []Frame

func (*Frames) StackTraceZ

func (fz *Frames) StackTraceZ() *Frames

type StackTracerZ

type StackTracerZ interface {
	StackTraceZ() *Frames
}

Jump to

Keyboard shortcuts

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