[PATCH v10 06/10] eal: change rte_exit() output to match rte_log()
Tyler Retzlaff
roretzla at linux.microsoft.com
Thu Mar 21 18:04:51 CET 2024
On Thu, Mar 21, 2024 at 09:00:22AM -0700, Stephen Hemminger wrote:
> The rte_exit() output format confuses the timestamp and coloring
> options. Change it to use be a single line with proper prefix.
>
> Before:
> [ 0.006481] EAL: Error - exiting with code: 1
> Cause: [ 0.006489] Cannot init EAL: Permission denied
>
> After:
> [ 0.006238] EAL: Error - exiting with code: 1
> [ 0.006250] EAL: Cause: Cannot init EAL: Permission denied
it is better but maybe : -> - for Cause?
[ 0.006238] EAL: Error - exiting with code: 1
[ 0.006250] EAL: Cause - Cannot init EAL: Permission denied
>
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> ---
ACked-by: Tyler Retzlaff <roretzla at linux.microsoft.com>
> lib/eal/common/eal_common_debug.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/lib/eal/common/eal_common_debug.c b/lib/eal/common/eal_common_debug.c
> index 3e77995896d5..568883830f20 100644
> --- a/lib/eal/common/eal_common_debug.c
> +++ b/lib/eal/common/eal_common_debug.c
> @@ -34,17 +34,18 @@ void
> rte_exit(int exit_code, const char *format, ...)
> {
> va_list ap;
> + char *msg = NULL;
>
> if (exit_code != 0)
> - RTE_LOG(CRIT, EAL, "Error - exiting with code: %d\n"
> - " Cause: ", exit_code);
> + EAL_LOG(CRIT, "Error - exiting with code: %d", exit_code);
>
> va_start(ap, format);
> - rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
> + vasprintf(&msg, format, ap);
> va_end(ap);
>
> + rte_log(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, "EAL: Cause: %s", msg);
> +
> if (rte_eal_cleanup() != 0 && rte_errno != EALREADY)
> - EAL_LOG(CRIT,
> - "EAL could not release all resources");
> + EAL_LOG(CRIT, "EAL could not release all resources");
> exit(exit_code);
> }
> --
> 2.43.0
More information about the dev
mailing list