[06/27] event/dlb: add dynamic logging

Message ID 1596138614-17409-7-git-send-email-timothy.mcdaniel@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Jerin Jacob
Headers
Series Add Intel DLM PMD to 20.11 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply issues

Commit Message

Timothy McDaniel July 30, 2020, 7:49 p.m. UTC
  From: "McDaniel, Timothy" <timothy.mcdaniel@intel.com>

Signed-off-by: McDaniel, Timothy <timothy.mcdaniel@intel.com>
---
 drivers/event/dlb/dlb_log.h |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 drivers/event/dlb/dlb_log.h
  

Comments

Jerin Jacob Aug. 11, 2020, 6:27 p.m. UTC | #1
On Fri, Jul 31, 2020 at 1:24 AM McDaniel, Timothy
<timothy.mcdaniel@intel.com> wrote:
>
> From: "McDaniel, Timothy" <timothy.mcdaniel@intel.com>

Please avoid empty comments.

>
> Signed-off-by: McDaniel, Timothy <timothy.mcdaniel@intel.com>
> ---
>  drivers/event/dlb/dlb_log.h |   25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
>  create mode 100644 drivers/event/dlb/dlb_log.h
>
> diff --git a/drivers/event/dlb/dlb_log.h b/drivers/event/dlb/dlb_log.h
> new file mode 100644
> index 0000000..c69c9e5
> --- /dev/null
> +++ b/drivers/event/dlb/dlb_log.h
> @@ -0,0 +1,25 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2016-2020 Intel Corporation
> + */
> +
> +#ifndef _DLB_EVDEV_LOG_H_
> +#define _DLB_EVDEV_LOG_H_
> +
> +extern int eventdev_dlb_log_level;

RTE_LOG_REGISTER is missing. Use real dynamic logging.


> +
> +/* Dynamic logging */
> +#define DLB_LOG_IMPL(level, fmt, args...) \
> +       rte_log(RTE_LOG_ ## level, eventdev_dlb_log_level, "%s" fmt "\n", \
> +               __func__, ##args)
> +
> +#define DLB_LOG_INFO(fmt, args...) \
> +       DLB_LOG_IMPL(INFO, fmt, ## args)
> +
> +#define DLB_LOG_ERR(fmt, args...) \
> +       DLB_LOG_IMPL(ERR, fmt, ## args)
> +
> +/* remove debug logs at compile time unless actually debugging */
> +#define DLB_LOG_DBG(fmt, args...) \
> +       RTE_LOG_DP(DEBUG, PMD, fmt, ## args)
> +
> +#endif /* _DLB_EVDEV_LOG_H_ */
> --
> 1.7.10
>
  

Patch

diff --git a/drivers/event/dlb/dlb_log.h b/drivers/event/dlb/dlb_log.h
new file mode 100644
index 0000000..c69c9e5
--- /dev/null
+++ b/drivers/event/dlb/dlb_log.h
@@ -0,0 +1,25 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2016-2020 Intel Corporation
+ */
+
+#ifndef _DLB_EVDEV_LOG_H_
+#define _DLB_EVDEV_LOG_H_
+
+extern int eventdev_dlb_log_level;
+
+/* Dynamic logging */
+#define DLB_LOG_IMPL(level, fmt, args...) \
+	rte_log(RTE_LOG_ ## level, eventdev_dlb_log_level, "%s" fmt "\n", \
+		__func__, ##args)
+
+#define DLB_LOG_INFO(fmt, args...) \
+	DLB_LOG_IMPL(INFO, fmt, ## args)
+
+#define DLB_LOG_ERR(fmt, args...) \
+	DLB_LOG_IMPL(ERR, fmt, ## args)
+
+/* remove debug logs at compile time unless actually debugging */
+#define DLB_LOG_DBG(fmt, args...) \
+	RTE_LOG_DP(DEBUG, PMD, fmt, ## args)
+
+#endif /* _DLB_EVDEV_LOG_H_ */