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 60398293B for ; Mon, 6 Feb 2017 14:29:43 +0100 (CET) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id AA34C24A21; Mon, 6 Feb 2017 14:29:38 +0100 (CET) From: Olivier Matz To: dev@dpdk.org, david.marchand@6wind.com Date: Mon, 6 Feb 2017 14:29:13 +0100 Message-Id: <1486387756-16865-6-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1486387756-16865-1-git-send-email-olivier.matz@6wind.com> References: <1486387756-16865-1-git-send-email-olivier.matz@6wind.com> Subject: [dpdk-dev] [RFC 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: Mon, 06 Feb 2017 13:29:43 -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 --- app/test/test_logs.c | 6 +++--- 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 ++ 7 files changed, 48 insertions(+), 9 deletions(-) diff --git a/app/test/test_logs.c b/app/test/test_logs.c index 805c568..730a86b 100644 --- a/app/test/test_logs.c +++ b/app/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"); diff --git a/examples/quota_watermark/qw/main.c b/examples/quota_watermark/qw/main.c index 9162e28..b13df5b 100644 --- a/examples/quota_watermark/qw/main.c +++ b/examples/quota_watermark/qw/main.c @@ -311,7 +311,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 29c501c..d2c48b8 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 5668d48..7e190cf 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -185,6 +185,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 f133c4f..81c092f 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -189,6 +189,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; -- 2.8.1