- Notifications
You must be signed in to change notification settings - Fork35
Package stack implements utilities to capture, manipulate, and format call stacks.
License
go-stack/stack
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Package stack implements utilities to capture, manipulate, and format callstacks. It provides a simpler API than package runtime.
The implementation takes care of the minutia and special cases of interpretingthe program counter (pc) values returned by runtime.Callers.
Package stack publishes releases viasemver compatible Gittags prefixed with a single 'v'. The master branch always contains the latestrelease. The develop branch contains unreleased commits.
Package stack's types implement fmt.Formatter, which provides a simple andflexible way to declaratively configure formatting when used with logging orerror tracking packages.
funcDoTheThing() {c:=stack.Caller(0)log.Print(c)// "source.go:10"log.Printf("%+v",c)// "pkg/path/source.go:10"log.Printf("%n",c)// "DoTheThing"s:=stack.Trace().TrimRuntime()log.Print(s)// "[source.go:15 caller.go:42 main.go:14]"}
See the docs for all of the supported formatting options.
About
Package stack implements utilities to capture, manipulate, and format call stacks.