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

Method setLoggingPolicyFromFlags

cli/command_policy_set_logging.go:31–57  ·  view source on GitHub ↗
(ctx context.Context, p *policy.LoggingPolicy, changeCount *int)

Source from the content-addressed store, hash-verified

29}
30
31func (c *policyLoggingFlags) setLoggingPolicyFromFlags(ctx context.Context, p *policy.LoggingPolicy, changeCount *int) error {
32 if err := applyPolicyLogDetailPtr(ctx, "directory snapshotted detail", &p.Directories.Snapshotted, c.dirSnapshottedDetail, changeCount); err != nil {
33 return errors.Wrap(err, "directory snapshotted detail")
34 }
35
36 if err := applyPolicyLogDetailPtr(ctx, "directory ignored detail", &p.Directories.Ignored, c.dirIgnoredDetail, changeCount); err != nil {
37 return errors.Wrap(err, "directory ignored detail")
38 }
39
40 if err := applyPolicyLogDetailPtr(ctx, "entry snapshotted detail", &p.Entries.Snapshotted, c.entrySnapshottedDetail, changeCount); err != nil {
41 return errors.Wrap(err, "entry snapshotted detail")
42 }
43
44 if err := applyPolicyLogDetailPtr(ctx, "entry ignored detail", &p.Entries.Ignored, c.entryIgnoredDetail, changeCount); err != nil {
45 return errors.Wrap(err, "entry ignored detail")
46 }
47
48 if err := applyPolicyLogDetailPtr(ctx, "entry cache hit detail", &p.Entries.CacheHit, c.entryCacheHitDetail, changeCount); err != nil {
49 return errors.Wrap(err, "entry cache hit detail")
50 }
51
52 if err := applyPolicyLogDetailPtr(ctx, "entry cache miss detail", &p.Entries.CacheMiss, c.entryCacheMissDetail, changeCount); err != nil {
53 return errors.Wrap(err, "entry cache miss detail")
54 }
55
56 return nil
57}
58
59func applyPolicyLogDetailPtr(ctx context.Context, desc string, val **policy.LogDetail, str string, changeCount *int) error {
60 if str == "" {

Callers 1

setPolicyFromFlagsMethod · 0.80

Calls 1

applyPolicyLogDetailPtrFunction · 0.85

Tested by

no test coverage detected