From 6bd6c80f27c708f72aef1d850e48deaef832477e Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Thu, 2 Nov 2023 18:40:32 +0000 Subject: dev: strip debig log function name prefix during compilation Type: improvement Change-Id: I9b9bb37a0895366b412f042b0e2da5bbdd477325 Signed-off-by: Damjan Marion --- src/vnet/dev/dev.h | 1 + src/vnet/dev/format.c | 6 +----- src/vnet/dev/log.h | 5 ++--- 3 files changed, 4 insertions(+), 8 deletions(-) (limited to 'src/vnet/dev') diff --git a/src/vnet/dev/dev.h b/src/vnet/dev/dev.h index 5c80b98f580..9b54e737307 100644 --- a/src/vnet/dev/dev.h +++ b/src/vnet/dev/dev.h @@ -613,6 +613,7 @@ format_function_t format_vnet_dev_rx_queue_info; format_function_t format_vnet_dev_tx_queue_info; format_function_t format_vnet_dev_flags; format_function_t format_vnet_dev_port_flags; +format_function_t format_vnet_dev_log; unformat_function_t unformat_vnet_dev_flags; unformat_function_t unformat_vnet_dev_port_flags; diff --git a/src/vnet/dev/format.c b/src/vnet/dev/format.c index 4e1ece66d31..b8b7dbdcb10 100644 --- a/src/vnet/dev/format.c +++ b/src/vnet/dev/format.c @@ -394,11 +394,7 @@ format_vnet_dev_log (u8 *s, va_list *args) if (dev && func) vec_add1 (s, ' '); if (func) - { - if (strncmp (func, "vnet_dev_", 9) == 0) - func += 9; - s = format (s, "%s", func); - } + s = format (s, "%s", func); vec_add1 (s, ':'); vec_add1 (s, ' '); return s; diff --git a/src/vnet/dev/log.h b/src/vnet/dev/log.h index 432e7b88a21..5ca7b6620e9 100644 --- a/src/vnet/dev/log.h +++ b/src/vnet/dev/log.h @@ -5,11 +5,10 @@ #ifndef _VNET_DEV_LOG_H_ #define _VNET_DEV_LOG_H_ -format_function_t format_vnet_dev_log; - #define log_debug(dev, f, ...) \ vlib_log (VLIB_LOG_LEVEL_DEBUG, dev_log.class, "%U" f, format_vnet_dev_log, \ - dev, __func__, ##__VA_ARGS__) + dev, clib_string_skip_prefix (__func__, "vnet_dev_"), \ + ##__VA_ARGS__) #define log_notice(dev, f, ...) \ vlib_log (VLIB_LOG_LEVEL_NOTICE, dev_log.class, "%U" f, \ format_vnet_dev_log, dev, 0, ##__VA_ARGS__) -- cgit 1.2.3-korg