From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 74DA4CF66 for ; Fri, 17 Mar 2017 16:51:44 +0100 (CET) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 4070825393; Fri, 17 Mar 2017 16:51:39 +0100 (CET) From: Olivier Matz To: dev@dpdk.org Cc: thomas.monjalon@6wind.com, david.marchand@6wind.com, bruce.richardson@intel.com, keith.wiles@intel.com Date: Fri, 17 Mar 2017 16:51:19 +0100 Message-Id: <1489765882-30497-6-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1489765882-30497-1-git-send-email-olivier.matz@6wind.com> References: <1486387756-16865-1-git-send-email-olivier.matz@6wind.com> <1489765882-30497-1-git-send-email-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH 5/8] eal: deprecate log functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Mar 2017 15:51:44 -0000 Deprecate the following functions: - rte_set_log_level(), replaced by rte_log_set_global_level() - rte_get_log_level(), replaced by rte_log_get_global_level() - rte_set_log_type(), rte_log_set_level() - rte_get_log_type(), rte_log_get_level() The new functions provide a better control of the per-type log level, and have a better name prefix (rte_log_). Signed-off-by: Olivier Matz --- examples/quota_watermark/qw/main.c | 2 +- examples/quota_watermark/qwctl/qwctl.c | 2 +- lib/librte_eal/bsdapp/eal/rte_eal_version.map | 2 ++ lib/librte_eal/common/eal_common_log.c | 24 ++++++++++++++++++++---- lib/librte_eal/common/include/rte_log.h | 19 +++++++++++++++++++ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 ++ test/test/test_logs.c | 6 +++--- 7 files changed, 48 insertions(+), 9 deletions(-) diff --git a/examples/quota_watermark/qw/main.c b/examples/quota_watermark/qw/main.c index 57df8ef..5ba74e2 100644 --- a/examples/quota_watermark/qw/main.c +++ b/examples/quota_watermark/qw/main.c @@ -321,7 +321,7 @@ main(int argc, char **argv) uint8_t port_id; - rte_set_log_level(RTE_LOG_INFO); + rte_log_set_global_level(RTE_LOG_INFO); ret = rte_eal_init(argc, argv); if (ret < 0) diff --git a/examples/quota_watermark/qwctl/qwctl.c b/examples/quota_watermark/qwctl/qwctl.c index 3a85cc3..7db66a1 100644 --- a/examples/quota_watermark/qwctl/qwctl.c +++ b/examples/quota_watermark/qwctl/qwctl.c @@ -75,7 +75,7 @@ int main(int argc, char **argv) int ret; struct cmdline *cl; - rte_set_log_level(RTE_LOG_INFO); + rte_log_set_global_level(RTE_LOG_INFO); ret = rte_eal_init(argc, argv); if (ret < 0) diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index be829cb..bccaafa 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -182,6 +182,8 @@ DPDK_17.02 { rte_bus_unregister; rte_log_dump; rte_log_register; + rte_log_get_global_level; + rte_log_set_global_level; rte_log_set_level; rte_log_set_level_regexp; diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c index b35c8b2..3888044 100644 --- a/lib/librte_eal/common/eal_common_log.c +++ b/lib/librte_eal/common/eal_common_log.c @@ -86,20 +86,36 @@ rte_openlog_stream(FILE *f) /* Set global log level */ void -rte_set_log_level(uint32_t level) +rte_log_set_global_level(uint32_t level) { rte_logs.level = (uint32_t)level; } +/* Set global log level */ +/* replaced by rte_log_set_global_level */ +__rte_deprecated void +rte_set_log_level(uint32_t level) +{ + rte_log_set_global_level(level); +} + /* Get global log level */ uint32_t -rte_get_log_level(void) +rte_log_get_global_level(void) { return rte_logs.level; } +/* Get global log level */ +/* replaced by rte_log_get_global_level */ +uint32_t +rte_get_log_level(void) +{ + return rte_log_get_global_level(); +} + /* Set global log type */ -void +__rte_deprecated void rte_set_log_type(uint32_t type, int enable) { if (type < RTE_LOGTYPE_FIRST_EXT_ID) { @@ -116,7 +132,7 @@ rte_set_log_type(uint32_t type, int enable) } /* Get global log type */ -uint32_t +__rte_deprecated uint32_t rte_get_log_type(void) { return rte_logs.type; diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h index ce48b07..27c40b4 100644 --- a/lib/librte_eal/common/include/rte_log.h +++ b/lib/librte_eal/common/include/rte_log.h @@ -50,6 +50,8 @@ extern "C" { #include #include +#include + struct rte_log_dynamic_type; /** The rte_log structure. */ @@ -132,11 +134,26 @@ int rte_openlog_stream(FILE *f); * @param level * Log level. A value between RTE_LOG_EMERG (1) and RTE_LOG_DEBUG (8). */ +void rte_log_set_global_level(uint32_t level); + +/** + * Deprecated, replaced by rte_log_set_global_level(). + */ +__rte_deprecated void rte_set_log_level(uint32_t level); /** * Get the global log level. + * + * @return + * The current global log level. + */ +uint32_t rte_log_get_global_level(void); + +/** + * Deprecated, replaced by rte_log_get_global_level(). */ +__rte_deprecated uint32_t rte_get_log_level(void); /** @@ -147,11 +164,13 @@ uint32_t rte_get_log_level(void); * @param enable * True for enable; false for disable. */ +__rte_deprecated void rte_set_log_type(uint32_t type, int enable); /** * Get the global log type. */ +__rte_deprecated uint32_t rte_get_log_type(void); /** diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index a8116ed..3b50c4c 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -186,6 +186,8 @@ DPDK_17.02 { rte_bus_unregister; rte_log_dump; rte_log_register; + rte_log_get_global_level; + rte_log_set_global_level; rte_log_set_level; rte_log_set_level_regexp; diff --git a/test/test/test_logs.c b/test/test/test_logs.c index 805c568..730a86b 100644 --- a/test/test/test_logs.c +++ b/test/test/test_logs.c @@ -66,12 +66,12 @@ test_logs(void) rte_log_set_level(RTE_LOGTYPE_TESTAPP2, RTE_LOG_EMERG); /* log in error level */ - rte_set_log_level(RTE_LOG_ERR); + rte_log_set_global_level(RTE_LOG_ERR); RTE_LOG(ERR, TESTAPP1, "error message\n"); RTE_LOG(CRIT, TESTAPP1, "critical message\n"); /* log in critical level */ - rte_set_log_level(RTE_LOG_CRIT); + rte_log_set_global_level(RTE_LOG_CRIT); RTE_LOG(ERR, TESTAPP2, "error message (not displayed)\n"); RTE_LOG(CRIT, TESTAPP2, "critical message\n"); @@ -79,7 +79,7 @@ test_logs(void) rte_log_set_level(RTE_LOGTYPE_TESTAPP2, RTE_LOG_DEBUG); /* log in error level */ - rte_set_log_level(RTE_LOG_ERR); + rte_log_set_global_level(RTE_LOG_ERR); RTE_LOG(ERR, TESTAPP1, "error message\n"); RTE_LOG(ERR, TESTAPP2, "error message (not displayed)\n"); -- 2.8.1