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 E63B93772 for ; Tue, 4 Apr 2017 18:44:47 +0200 (CEST) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 4D1B3258C2; Tue, 4 Apr 2017 18:44:42 +0200 (CEST) From: Olivier Matz To: dev@dpdk.org Cc: david.marchand@6wind.com, bruce.richardson@intel.com, thomas.monjalon@6wind.com, keith.wiles@intel.com, stephen@networkplumber.org Date: Tue, 4 Apr 2017 18:40:37 +0200 Message-Id: <20170404164040.24132-6-olivier.matz@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170404164040.24132-1-olivier.matz@6wind.com> References: <20170329155323.4760-1-olivier.matz@6wind.com> <20170404164040.24132-1-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH v3 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: Tue, 04 Apr 2017 16:44:48 -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(), replaced by rte_log_set_level() - rte_get_log_type(), replaced by 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 --- doc/guides/rel_notes/deprecation.rst | 8 ++++++++ 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 | 26 ++++++++++++++++++++----- lib/librte_eal/common/eal_common_options.c | 2 +- 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 +++--- 9 files changed, 58 insertions(+), 11 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index d6544ed0a..4148c4c43 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -118,3 +118,11 @@ Deprecation Notices to specify which type of instance to create (single or burst), and additional calls for ``rte_distributor_poll_pkt_burst`` and ``rte_distributor_return_pkt_burst``, among others. + +* eal: the following functions are deprecated starting from 17.05 and will + be removed in 17.08: + + - ``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``, replaced by ``rte_log_set_level`` + - ``rte_get_log_type``, replaced by ``rte_log_get_level`` diff --git a/examples/quota_watermark/qw/main.c b/examples/quota_watermark/qw/main.c index bdb8a4399..d4fcfde48 100644 --- a/examples/quota_watermark/qw/main.c +++ b/examples/quota_watermark/qw/main.c @@ -326,7 +326,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 7e7a396e5..18ec17a17 100644 --- a/examples/quota_watermark/qwctl/qwctl.c +++ b/examples/quota_watermark/qwctl/qwctl.c @@ -77,7 +77,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 de74ff9ff..e4d3665d8 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -188,6 +188,8 @@ DPDK_17.05 { 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 d02689390..dd4d30ca7 100644 --- a/lib/librte_eal/common/eal_common_log.c +++ b/lib/librte_eal/common/eal_common_log.c @@ -84,20 +84,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) { @@ -114,7 +130,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; @@ -287,7 +303,7 @@ rte_log_dump(FILE *f) size_t i; fprintf(f, "global log level is %s\n", - loglevel_to_string(rte_get_log_level())); + loglevel_to_string(rte_log_get_global_level())); for (i = 0; i < rte_logs.dynamic_types_len; i++) { if (rte_logs.dynamic_types[i].name == NULL) diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index 606695a7f..32df2ef45 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -773,7 +773,7 @@ eal_parse_log_level(const char *arg, struct internal_config *conf) if (type == NULL) { conf->log_level = tmp; - rte_set_log_level(tmp); + rte_log_set_global_level(tmp); } else if (rte_log_set_level_regexp(type, tmp) < 0) { printf("cannot set log level %s,%lu\n", type, tmp); diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h index ce48b0785..27c40b452 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 f70b4b937..4c55114d6 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -192,6 +192,8 @@ DPDK_17.05 { 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 805c56810..730a86bd9 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.11.0