diff options
author | Nalin Dahyabhai <nalin@redhat.com> | 2021-04-14 13:43:58 -0400 |
---|---|---|
committer | Nalin Dahyabhai <nalin@redhat.com> | 2021-04-14 13:45:36 -0400 |
commit | 6bde4d00dd5d1ce62585c3aac10076d53b3d9e1f (patch) | |
tree | 853d6fe2a125021a8f6e4b29df99143edc926ae4 | |
parent | 9b3226a80a35ee85eebb6d910f9608dc301f0e72 (diff) | |
download | podman-6bde4d00dd5d1ce62585c3aac10076d53b3d9e1f.tar.gz podman-6bde4d00dd5d1ce62585c3aac10076d53b3d9e1f.tar.bz2 podman-6bde4d00dd5d1ce62585c3aac10076d53b3d9e1f.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>
-rw-r--r-- | cmd/podman/root.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd/podman/root.go b/cmd/podman/root.go index 4527c2646..9e5d2a236 100644 --- a/cmd/podman/root.go +++ b/cmd/podman/root.go @@ -416,7 +416,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 } |