From 2d3da8054bab654f36c26a04557c073b12594530 Mon Sep 17 00:00:00 2001 From: luoyaozu Date: Wed, 23 Nov 2022 15:59:17 +0800 Subject: vlib: fix vlib_log for elog test output before fix: DBGvpp# event-logger clear DBGvpp# test log warn cli log test-log for-elog cli/log [warn ]: test-log for-elog DBGvpp# test log info cli log test-log for-elog cli/log [info ]: test-log for-elog DBGvpp# show event-logger 2 of 131072 events in buffer, logger running 53.022586433: log-notice: test-log for-elog 60.318329361: log-debug: test-log for-elog DBGvpp# test output after fix: DBGvpp# event-logger clear DBGvpp# test log warn cli log test-log for-elog cli/log [warn ]: test-log for-elog DBGvpp# test log info cli log test-log for-elog cli/log [info ]: test-log for-elog DBGvpp# show event-logger 2 of 131072 events in buffer, logger running 18.362721151: log-warn: test-log for-elog 25.124570555: log-info: test-log for-elog DBGvpp# Type: fix Signed-off-by: luoyaozu Change-Id: Ie1122787f9efb611cdafc671b4ccf68b43984924 --- src/vlib/log.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/vlib/log.c b/src/vlib/log.c index d084511a647..f176062fd0c 100644 --- a/src/vlib/log.c +++ b/src/vlib/log.c @@ -226,13 +226,13 @@ vlib_log (vlib_log_level_t level, vlib_log_class_t class, char *fmt, ...) if (lm->add_to_elog) { - /* *INDENT-OFF* */ - ELOG_TYPE_DECLARE(ee) = + ELOG_TYPE_DECLARE(ee) = { .format = "log-%s: %s", .format_args = "t4T4", - .n_enum_strings = 9, + .n_enum_strings = VLIB_LOG_N_LEVELS, .enum_strings = { + "unknown", "emerg", "alert", "crit", @@ -244,11 +244,11 @@ vlib_log (vlib_log_level_t level, vlib_log_class_t class, char *fmt, ...) "disabled", }, }; - struct { - u32 log_level; - u32 string_index; - } *ed; - /* *INDENT-ON* */ + struct + { + u32 log_level; + u32 string_index; + } * ed; ed = ELOG_DATA (&vlib_global_main.elog_main, ee); ed->log_level = level; ed->string_index = -- cgit 1.2.3-korg