You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Package stack implements utilities to capture, manipulate, and format call stacks. It provides a simpler API than package runtime.
6
8
7
9
The implementation takes care of the minutia and special cases of interpreting the program counter (pc) values returned by runtime.Callers.
8
10
11
+
## Versioning
12
+
Package stack publishes stable APIs via gopkg.in. The most recent is v0 (the API is still baking, please file an issue if you have any suggestions), which is imported like so:
13
+
14
+
import "gopkg.in/stack.v0"
15
+
16
+
## Formatting
9
17
Package stack's types implement fmt.Formatter, which provides a simple and flexible way to declaratively configure formatting when used with logging or error tracking packages.
18
+
19
+
```go
20
+
funcDoTheThing() {
21
+
c:= stack.Caller(0)
22
+
log.Print(c) // might log "source.go:10"
23
+
log.Printf("%+v", c) // might log "pkg/path/source.go:10"
0 commit comments