mirror of
https://github.com/containers/podman.git
synced 2025-06-23 10:38:20 +08:00
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>
This commit is contained in:
@ -416,7 +416,11 @@ func formatError(err error) string {
|
|||||||
strings.TrimSuffix(err.Error(), ": "+define.ErrOCIRuntime.Error()),
|
strings.TrimSuffix(err.Error(), ": "+define.ErrOCIRuntime.Error()),
|
||||||
)
|
)
|
||||||
} else {
|
} 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
|
return message
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user