DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] doc: replace code blocks with includes in logging guide
@ 2024-02-27 14:21 David Marchand
  2024-03-06 21:10 ` David Marchand
  0 siblings, 1 reply; 2+ messages in thread
From: David Marchand @ 2024-02-27 14:21 UTC (permalink / raw)
  To: dev; +Cc: roretzla, Chengwen Feng, Andrew Rybchenko

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] doc: replace code blocks with includes in logging guide
  2024-02-27 14:21 [PATCH] doc: replace code blocks with includes in logging guide David Marchand
@ 2024-03-06 21:10 ` David Marchand
  0 siblings, 0 replies; 2+ messages in thread
From: David Marchand @ 2024-03-06 21:10 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, roretzla, Chengwen Feng, Andrew Rybchenko

On Tue, Feb 27, 2024 at 3:22 PM David Marchand
<david.marchand@redhat.com> wrote:
>
> 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>

Applied.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-06 21:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-27 14:21 [PATCH] doc: replace code blocks with includes in logging guide David Marchand
2024-03-06 21:10 ` David Marchand

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).