From dd67a3d5f5bb67af7a54728cedbba0448a0061d3 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 30 Dec 2020 13:07:47 +0000 Subject: [PATCH] operations: add size if known to skipped items and JSON log - fixes #4624 --- fs/operations/operations.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/operations/operations.go b/fs/operations/operations.go index 4bcb2cd86..e0b116cdf 100644 --- a/fs/operations/operations.go +++ b/fs/operations/operations.go @@ -2123,7 +2123,15 @@ func SkipDestructive(ctx context.Context, subject interface{}, action string) (s return false } if skip { - fs.Logf(subject, "Skipped %s as %s is set", action, flag) + size := int64(-1) + if do, ok := subject.(interface{ Size() int64 }); ok { + size = do.Size() + } + if size >= 0 { + fs.Logf(subject, "Skipped %s as %s is set (size %v)", fs.LogValue("skipped", action), flag, fs.LogValue("size", fs.SizeSuffix(size))) + } else { + fs.Logf(subject, "Skipped %s as %s is set", fs.LogValue("skipped", action), flag) + } } return skip }