#include <stdio.h>
#include <stdarg.h>
#include <stdbool.h>
-#include <sys/queue.h>
#include <rte_common.h>
#include <rte_config.h>
int rte_log_register(const char *name);
/**
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
* Register a dynamic log type and try to pick its level from EAL options
*
* rte_log_register() is called inside. If successful, the function tries
* - >=0: the newly registered log type
* - <0: rte_log_register() error value
*/
-__rte_experimental
int rte_log_register_type_and_pick_level(const char *name, uint32_t level_def);
/**
RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__) : \
0)
+#define RTE_LOG_REGISTER_IMPL(type, name, level) \
+int type; \
+RTE_INIT(__##type) \
+{ \
+ type = rte_log_register_type_and_pick_level(name, RTE_LOG_##level); \
+ if (type < 0) \
+ type = RTE_LOGTYPE_EAL; \
+}
+
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice
* @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); \
- if (type < 0) \
- type = RTE_LOGTYPE_EAL; \
-}
+#define RTE_LOG_REGISTER(type, name, level) \
+ RTE_LOG_REGISTER_IMPL(type, RTE_STR(name), level)
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * This is an equivalent to RTE_LOG_REGISTER, but relying on the build system
+ * to select the right format for the logtype.
+ */
+#define RTE_LOG_REGISTER_DEFAULT(type, level) \
+ RTE_LOG_REGISTER_IMPL(type, RTE_STR(RTE_LOG_DEFAULT_LOGTYPE), level)
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * This is an equivalent to RTE_LOG_REGISTER, but relying on the build system
+ * to select the right prefix for the logtype.
+ */
+#define RTE_LOG_REGISTER_SUFFIX(type, suffix, level) \
+ RTE_LOG_REGISTER_IMPL(type, \
+ RTE_STR(RTE_LOG_DEFAULT_LOGTYPE) "." RTE_STR(suffix), level)
#ifdef __cplusplus
}