X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_eal%2Fcommon%2Finclude%2Frte_log.h;h=a497e195d5b470bdae552ac3a033c2e43ae55ad5;hb=df3ff6be2b33faea3edf3c112b9bdc5b74d6f684;hp=cbb41846aaa35f72fa2184d10596424c31845aa0;hpb=8bd5f07c7a1ac0c5b8d16758efc3ada3e16b0adc;p=dpdk.git diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h index cbb41846aa..a497e195d5 100644 --- a/lib/librte_eal/common/include/rte_log.h +++ b/lib/librte_eal/common/include/rte_log.h @@ -20,6 +20,7 @@ extern "C" { #include #include #include +#include #include #include @@ -101,6 +102,19 @@ extern struct rte_logs rte_logs; */ int rte_openlog_stream(FILE *f); +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Retrieve the stream used by the logging system (see rte_openlog_stream() + * to change it). + * + * @return + * Pointer to the stream. + */ +__rte_experimental +FILE *rte_log_get_stream(void); + /** * Set the global log level. * @@ -130,6 +144,19 @@ uint32_t rte_log_get_global_level(void); */ int rte_log_get_level(uint32_t logtype); +/** + * For a given `logtype`, check if a log with `loglevel` can be printed. + * + * @param logtype + * The log type identifier + * @param loglevel + * Log level. A value between RTE_LOG_EMERG (1) and RTE_LOG_DEBUG (8). + * @return + * Returns 'true' if log can be printed and 'false' if it can't. + */ +__rte_experimental +bool rte_log_can_log(uint32_t logtype, uint32_t loglevel); + /** * Set the log level for a given type based on shell pattern. * @@ -269,7 +296,7 @@ int rte_log(uint32_t level, uint32_t logtype, const char *format, ...) __attribute__((cold)) #endif #endif - __attribute__((format(printf, 3, 4))); + __rte_format_printf(3, 4); /** * Generates a log message. @@ -298,7 +325,7 @@ int rte_log(uint32_t level, uint32_t logtype, const char *format, ...) * - Negative on error. */ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap) - __attribute__((format(printf,3,0))); + __rte_format_printf(3, 0); /** * Generates a log message.