mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
go1.16 (#14783)
This commit is contained in:
8
vendor/go.uber.org/zap/field.go
generated
vendored
8
vendor/go.uber.org/zap/field.go
generated
vendored
@@ -364,11 +364,17 @@ func Timep(key string, val *time.Time) Field {
|
||||
// expensive (relatively speaking); this function both makes an allocation and
|
||||
// takes about two microseconds.
|
||||
func Stack(key string) Field {
|
||||
return StackSkip(key, 1) // skip Stack
|
||||
}
|
||||
|
||||
// StackSkip constructs a field similarly to Stack, but also skips the given
|
||||
// number of frames from the top of the stacktrace.
|
||||
func StackSkip(key string, skip int) Field {
|
||||
// Returning the stacktrace as a string costs an allocation, but saves us
|
||||
// from expanding the zapcore.Field union struct to include a byte slice. Since
|
||||
// taking a stacktrace is already so expensive (~10us), the extra allocation
|
||||
// is okay.
|
||||
return String(key, takeStacktrace())
|
||||
return String(key, takeStacktrace(skip+1)) // skip StackSkip
|
||||
}
|
||||
|
||||
// Duration constructs a field with the given key and value. The encoder
|
||||
|
Reference in New Issue
Block a user