(ctx context.Context, desc string, val **policy.LogDetail, str string, changeCount *int)
| 57 | } |
| 58 | |
| 59 | func applyPolicyLogDetailPtr(ctx context.Context, desc string, val **policy.LogDetail, str string, changeCount *int) error { |
| 60 | if str == "" { |
| 61 | // not changed |
| 62 | return nil |
| 63 | } |
| 64 | |
| 65 | if str == inheritPolicyString { |
| 66 | *changeCount++ |
| 67 | |
| 68 | log(ctx).Infof(" - resetting %q to a default value inherited from parent.", desc) |
| 69 | |
| 70 | *val = nil |
| 71 | |
| 72 | return nil |
| 73 | } |
| 74 | |
| 75 | v, err := strconv.Atoi(str) |
| 76 | if err != nil || v < int(policy.LogDetailNone) || v > int(policy.LogDetailMax) { |
| 77 | return errors.Errorf("must be >= %v and <= %v or %q", policy.LogDetailNone, policy.LogDetailMax, inheritPolicyString) |
| 78 | } |
| 79 | |
| 80 | *changeCount++ |
| 81 | |
| 82 | log(ctx).Infof(" - setting %q to %v.", desc, v) |
| 83 | |
| 84 | ov := policy.LogDetail(v) |
| 85 | *val = &ov |
| 86 | |
| 87 | return nil |
| 88 | } |
no test coverage detected
searching dependent graphs…