| 36 | } |
| 37 | |
| 38 | func callOverrideFromContext(ctx context.Context) (CallOverrideFunc, context.Context, bool) { |
| 39 | cofs, _ := ctx.Value(&callOverrideKey).([]CallOverrideFunc) |
| 40 | if len(cofs) == 0 { |
| 41 | return nil, nil, false |
| 42 | } |
| 43 | // We found a list of overrides; grab the last, and reconstitute a |
| 44 | // context that will hide it. |
| 45 | f := cofs[len(cofs)-1] |
| 46 | ctx = context.WithValue(ctx, &callOverrideKey, cofs[:len(cofs)-1]) |
| 47 | return f, ctx, true |
| 48 | } |
| 49 | |
| 50 | type logOverrideFunc func(level int64, format string, args ...interface{}) |
| 51 | |