Take returns a string representation of the current stacktrace. skip is the number of frames to skip before recording the stack trace. skip=0 identifies the caller of Take.
(skip int)
| 133 | // skip is the number of frames to skip before recording the stack trace. |
| 134 | // skip=0 identifies the caller of Take. |
| 135 | func Take(skip int) string { |
| 136 | stack := Capture(skip+1, Full) |
| 137 | defer stack.Free() |
| 138 | |
| 139 | buffer := bufferpool.Get() |
| 140 | defer buffer.Free() |
| 141 | |
| 142 | stackfmt := NewFormatter(buffer) |
| 143 | stackfmt.FormatStack(stack) |
| 144 | return buffer.String() |
| 145 | } |
| 146 | |
| 147 | // Formatter formats a stack trace into a readable string representation. |
| 148 | type Formatter struct { |