MCPcopy Create free account
hub / github.com/kopia/kopia / applyPolicyLogDetailPtr

Function applyPolicyLogDetailPtr

cli/command_policy_set_logging.go:59–88  ·  view source on GitHub ↗
(ctx context.Context, desc string, val **policy.LogDetail, str string, changeCount *int)

Source from the content-addressed store, hash-verified

57}
58
59func 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}

Callers 1

Calls 2

LogDetailTypeAlias · 0.92
ErrorfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…