summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@redhat.com>2021-04-14 13:43:58 -0400
committerMatthew Heon <mheon@redhat.com>2021-04-16 11:22:25 -0400
commit25a1e3f9d6d184bd5612fe0985acf9d49f5d0553 (patch)
tree7fbcd3273521700dda7536316d74d4d58112f08b /cmd/podman
parent044c0a5437f9f286061b8d8424a9258b2a7e21ce (diff)
downloadpodman-25a1e3f9d6d184bd5612fe0985acf9d49f5d0553.tar.gz
podman-25a1e3f9d6d184bd5612fe0985acf9d49f5d0553.tar.bz2
podman-25a1e3f9d6d184bd5612fe0985acf9d49f5d0553.zip
At trace log level, print error text using %+v instead of %v
If we're logging at trace level, use %+v instead of %v when printing an error at exit. If the error included stack information, this will cause the backtrace to be printed, which is very handy for debugging. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/root.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd/podman/root.go b/cmd/podman/root.go
index 7722e35dd..4ecad691e 100644
--- a/cmd/podman/root.go
+++ b/cmd/podman/root.go
@@ -408,7 +408,11 @@ func formatError(err error) string {
strings.TrimSuffix(err.Error(), ": "+define.ErrOCIRuntime.Error()),
)
} else {
- message = "Error: " + err.Error()
+ if logrus.IsLevelEnabled(logrus.TraceLevel) {
+ message = fmt.Sprintf("Error: %+v", err)
+ } else {
+ message = fmt.Sprintf("Error: %v", err)
+ }
}
return message
}