Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu
2019-08-05 11:22:41 -07:00
parent cb46663725
commit c99961c6c0
158 changed files with 8322 additions and 5290 deletions

View File

@@ -125,13 +125,13 @@ func (rl *respLogger) StacktraceWhen(pred StacktracePred) *respLogger {
// StatusIsNot returns a StacktracePred which will cause stacktraces to be logged
// for any status *not* in the given list.
func StatusIsNot(statuses ...int) StacktracePred {
statusesNoTrace := map[int]bool{}
for _, s := range statuses {
statusesNoTrace[s] = true
}
return func(status int) bool {
for _, s := range statuses {
if status == s {
return false
}
}
return true
_, ok := statusesNoTrace[status]
return !ok
}
}