From 301a28a093372f1182253d021659425070ae8747 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 28 Feb 2023 11:23:27 -0700 Subject: Shorten the log lines if < LogLevelDebug --- cmd/btrfs-rec/main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cmd/btrfs-rec/main.go') diff --git a/cmd/btrfs-rec/main.go b/cmd/btrfs-rec/main.go index d4165bf..dc00dab 100644 --- a/cmd/btrfs-rec/main.go +++ b/cmd/btrfs-rec/main.go @@ -103,7 +103,9 @@ func main() { ctx := cmd.Context() logger := textui.NewLogger(os.Stderr, logLevelFlag.Level) ctx = dlog.WithLogger(ctx, logger) - ctx = dlog.WithField(ctx, "mem", new(textui.LiveMemUse)) + if logLevelFlag.Level >= dlog.LogLevelDebug { + ctx = dlog.WithField(ctx, "mem", new(textui.LiveMemUse)) + } dlog.SetFallbackLogger(logger.WithField("btrfs-progs.THIS_IS_A_BUG", true)) grp := dgroup.NewGroup(ctx, dgroup.GroupConfig{ -- cgit v1.2.3-2-g168b