examples/l3fwd: merge l3fwd-acl example
[dpdk.git] / lib / eal / include / rte_log.h
index a1c608a..319e404 100644 (file)
@@ -21,7 +21,6 @@ extern "C" {
 #include <stdio.h>
 #include <stdarg.h>
 #include <stdbool.h>
-#include <sys/queue.h>
 
 #include <rte_common.h>
 #include <rte_config.h>
@@ -219,9 +218,6 @@ int rte_log_cur_msg_logtype(void);
 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
@@ -237,7 +233,6 @@ int rte_log_register(const char *name);
  *    - >=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);
 
 /**
@@ -373,6 +368,15 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
                 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
@@ -389,15 +393,29 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
  * @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
 }