X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_eal%2Finclude%2Frte_log.h;h=173004fd716c38f40b612893728d18f0a80e555a;hb=8d63961fc7137cab823f85a50ee82779792f21e4;hp=a497e195d5b470bdae552ac3a033c2e43ae55ad5;hpb=9c1e0dc39a03c95447095241eaf3764d2e0dd003;p=dpdk.git diff --git a/lib/librte_eal/include/rte_log.h b/lib/librte_eal/include/rte_log.h index a497e195d5..173004fd71 100644 --- a/lib/librte_eal/include/rte_log.h +++ b/lib/librte_eal/include/rte_log.h @@ -27,20 +27,6 @@ extern "C" { #include #include -struct rte_log_dynamic_type; - -/** The rte_log structure. */ -struct rte_logs { - uint32_t type; /**< Bitfield with enabled logs. */ - uint32_t level; /**< Log level. */ - FILE *file; /**< Output file set by rte_openlog_stream, or NULL. */ - size_t dynamic_types_len; - struct rte_log_dynamic_type *dynamic_types; -}; - -/** Global log information */ -extern struct rte_logs rte_logs; - /* SDK log type */ #define RTE_LOGTYPE_EAL 0 /**< Log related to eal. */ #define RTE_LOGTYPE_MALLOC 1 /**< Log related to malloc. */ @@ -103,16 +89,12 @@ 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); /** @@ -158,10 +140,10 @@ __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. + * Set the log level for a given type based on globbing pattern. * * @param pattern - * The match pattern identifying the log type. + * The globbing pattern identifying the log type. * @param level * The level to be set. * @return @@ -274,7 +256,7 @@ void rte_log_dump(FILE *f); * to rte_openlog_stream(). * * The level argument determines if the log should be displayed or - * not, depending on the global rte_logs variable. + * not, depending on the loglevel settings. * * The preferred alternative is the RTE_LOG() because it adds the * level and type in the logged string. @@ -293,7 +275,7 @@ void rte_log_dump(FILE *f); int rte_log(uint32_t level, uint32_t logtype, const char *format, ...) #ifdef __GNUC__ #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) - __attribute__((cold)) + __rte_cold #endif #endif __rte_format_printf(3, 4); @@ -305,7 +287,7 @@ int rte_log(uint32_t level, uint32_t logtype, const char *format, ...) * to rte_openlog_stream(). * * The level argument determines if the log should be displayed or - * not, depending on the global rte_logs variable. A trailing + * not, depending on the loglevel settings. A trailing * newline may be added if needed. * * The preferred alternative is the RTE_LOG() because it adds the @@ -376,6 +358,30 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap) RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__) : \ 0) +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Register a dynamic log type in constructor context with its name and level. + * + * It is a wrapper macro for declaring the logtype, register the log and + * sets it's level in the constructor context. + * + * @param type + * The log type identifier + * @param name + * Name for the log type to be registered + * @param level + * Log level. A value between EMERG (1) and DEBUG (8). + */ +#define RTE_LOG_REGISTER(type, name, level) \ +int type; \ +RTE_INIT(__##type) \ +{ \ + type = rte_log_register_type_and_pick_level(RTE_STR(name), \ + RTE_LOG_##level); \ +} + #ifdef __cplusplus } #endif