X-Git-Url: http://git.droids-corp.org/?p=dpdk.git;a=blobdiff_plain;f=lib%2Flibrte_eal%2Fcommon%2Finclude%2Frte_log.h;h=c224dedad2d719db1db1b2cc0cd414bc2dba2795;hp=c50d22ae25e840b9333e72f37fb703bfae5b5854;hb=c1b5fa94a46f;hpb=12e58e707cceb26378a40108db8e33a3cba357b9 diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h index c50d22ae25..c224dedad2 100644 --- a/lib/librte_eal/common/include/rte_log.h +++ b/lib/librte_eal/common/include/rte_log.h @@ -50,17 +50,21 @@ 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 informations */ extern struct rte_logs rte_logs; -/* SDK log type */ +/* SDK log type, keep sync'd with rte_log_init() */ #define RTE_LOGTYPE_EAL 0x00000001 /**< Log related to eal. */ #define RTE_LOGTYPE_MALLOC 0x00000002 /**< Log related to malloc. */ #define RTE_LOGTYPE_RING 0x00000004 /**< Log related to ring. */ @@ -92,6 +96,9 @@ extern struct rte_logs rte_logs; #define RTE_LOGTYPE_USER7 0x40000000 /**< User-defined log type 7. */ #define RTE_LOGTYPE_USER8 0x80000000 /**< User-defined log type 8. */ +/** First identifier for extended logs */ +#define RTE_LOGTYPE_FIRST_EXT_ID 32 + /* Can't use 0, as it gives compiler warnings */ #define RTE_LOG_EMERG 1U /**< System is unusable. */ #define RTE_LOG_ALERT 2U /**< Action must be taken immediately. */ @@ -148,6 +155,18 @@ void rte_set_log_type(uint32_t type, int enable); */ uint32_t rte_get_log_type(void); +/** + * Set the log level for a given type. + * + * @param logtype + * The log type identifier. + * @param level + * The level to be set. + * @return + * 0 on success, a negative value if logtype or level is invalid. + */ +int rte_log_set_level(uint32_t logtype, uint32_t level); + /** * Get the current loglevel for the message being processed. * @@ -176,6 +195,20 @@ int rte_log_cur_msg_loglevel(void); */ int rte_log_cur_msg_logtype(void); +/** + * Register a dynamic log type + * + * If a log is already registered with the same type, the returned value + * is the same than the previous one. + * + * @param name + * The string identifying the log type. + * @return + * - >0: success, the returned value is the log type identifier. + * - (-ENONEM): cannot allocate memory. + */ +int rte_log_register(const char *name); + /** * Generates a log message. *