StackSkip constructs a field similarly to Stack, but also skips the given number of frames from the top of the stacktrace.
(key string, skip int)
| 371 | // StackSkip constructs a field similarly to Stack, but also skips the given |
| 372 | // number of frames from the top of the stacktrace. |
| 373 | func StackSkip(key string, skip int) Field { |
| 374 | // Returning the stacktrace as a string costs an allocation, but saves us |
| 375 | // from expanding the zapcore.Field union struct to include a byte slice. Since |
| 376 | // taking a stacktrace is already so expensive (~10us), the extra allocation |
| 377 | // is okay. |
| 378 | return String(key, stacktrace.Take(skip+1)) // skip StackSkip |
| 379 | } |
| 380 | |
| 381 | // Duration constructs a field with the given key and value. The encoder |
| 382 | // controls how the duration is serialized. |