DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: roretzla@linux.microsoft.com,
	Chengwen Feng <fengchengwen@huawei.com>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Subject: [PATCH] doc: replace code blocks with includes in logging guide
Date: Tue, 27 Feb 2024 15:21:38 +0100	[thread overview]
Message-ID: <20240227142138.1942161-1-david.marchand@redhat.com> (raw)

Rather than have a block of code as example that gets unaligned as
time passes, add literal includes.

The coding style guide points at the cfgfile library, let's use it too
as an example.

Fixes: 97433132c2ed ("lib: use per line logging in helpers")

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 doc/guides/prog_guide/log_lib.rst | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/doc/guides/prog_guide/log_lib.rst b/doc/guides/prog_guide/log_lib.rst
index 19e295fc9b..ff9d1b54a2 100644
--- a/doc/guides/prog_guide/log_lib.rst
+++ b/doc/guides/prog_guide/log_lib.rst
@@ -82,16 +82,14 @@ They do this by:
 * Using the log-level definitions given in ``rte_log.h`` to allow short textual names to be used in
   place of the numeric log levels.
 
-The following code is taken from ``rte_dmadev.c`` and shows the log registration,
+The following code is taken from ``rte_cfgfile.c`` and shows the log registration,
 and subsequent definition of a shortcut logging macro.
 It can be used as a template for any new components using DPDK logging.
 
-.. code:: C
-
-	RTE_LOG_REGISTER_DEFAULT(rte_dma_logtype, INFO);
-	#define RTE_DMA_LOG(level, ...) \
-		rte_log(RTE_LOG_ ## level, rte_dma_logtype, RTE_FMT("dma: " \
-			RTE_FMT_HEAD(__VA_ARGS__,) "\n", RTE_FMT_TAIL(__VA_ARGS__,)))
+.. literalinclude:: ../../../lib/cfgfile/rte_cfgfile.c
+   :language: c
+   :start-after: Setting up dynamic logging 8<
+   :end-before: >8 End of setting up dynamic logging
 
 .. note::
 
@@ -104,10 +102,11 @@ It can be used as a template for any new components using DPDK logging.
 	and the logtype should be defined as an "extern int" in a common header file.
 	Any component-specific logging macro should similarly be defined in that header.
 
-Throughout the dmadev library, all logging calls are therefore of the form:
+Throughout the cfgfile library, all logging calls are therefore of the form:
 
 .. code:: C
 
-	RTE_DMA_LOG(ERR, "Name can't be NULL");
+	CFG_LOG(ERR, "missing cfgfile parameters");
 
-	RTE_DMA_LOG(WARNING, "Device %d already started", dev_id);
+	CFG_LOG(ERR, "invalid comment characters %c",
+	       params->comment_character);
-- 
2.43.0


             reply	other threads:[~2024-02-27 14:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 14:21 David Marchand [this message]
2024-03-06 21:10 ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240227142138.1942161-1-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=roretzla@linux.microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).