From: Olivier Matz Date: Tue, 4 Apr 2017 16:40:37 +0000 (+0200) Subject: eal: deprecate log functions X-Git-Tag: spdx-start~3782 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=4f0981e6ec6c;p=dpdk.git eal: deprecate log functions 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 --- diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index fcc2e865d3..efbccb0d65 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -8,6 +8,14 @@ API and ABI deprecation notices are to be posted here. Deprecation Notices ------------------- +* 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`` + * ring: Changes are planned to rte_ring APIs in release 17.05. Proposed changes include: diff --git a/examples/quota_watermark/qw/main.c b/examples/quota_watermark/qw/main.c index bdb8a43994..d4fcfde488 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 7e7a396e56..18ec17a17e 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 de74ff9ffd..e4d3665d8a 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 d026893909..dd4d30ca76 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 606695a7f3..32df2ef458 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 8e58812d46..c2ff9758a0 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. */ @@ -133,11 +135,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); /** @@ -148,11 +165,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 41f2c59cd1..830c8e4765 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -192,7 +192,9 @@ DPDK_17.05 { rte_intr_free_epoll_fd; rte_log_dump; + rte_log_get_global_level; rte_log_register; + 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 805c568108..730a86bd91 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");