MCPcopy
hub / github.com/uber-go/zap / StackSkip

Function StackSkip

field.go:373–379  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

371// StackSkip constructs a field similarly to Stack, but also skips the given
372// number of frames from the top of the stacktrace.
373func 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.

Callers 3

TestStackSkipFieldFunction · 0.85
StackFunction · 0.85

Calls 2

TakeFunction · 0.92
StringFunction · 0.85

Tested by 2

TestStackSkipFieldFunction · 0.68