Stack constructs a field that stores a stacktrace of the current goroutine under provided key. Keep in mind that taking a stacktrace is eager and expensive (relatively speaking); this function both makes an allocation and takes about two microseconds.
(key string)
| 365 | // expensive (relatively speaking); this function both makes an allocation and |
| 366 | // takes about two microseconds. |
| 367 | func Stack(key string) Field { |
| 368 | return StackSkip(key, 1) // skip Stack |
| 369 | } |
| 370 | |
| 371 | // StackSkip constructs a field similarly to Stack, but also skips the given |
| 372 | // number of frames from the top of the stacktrace. |