Skip to content

Commit eb1081e

Browse files
nordic-krchkartben
authored andcommitted
doc: services: logging: Clarify limitations
Add note about limitation regarding logging strings with width. Clarify that it is required to cast character pointer to non-character pointer when used with %p format specifier. Signed-off-by: Krzysztof Chruściński <[email protected]>
1 parent f1452f2 commit eb1081e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

doc/services/logging/index.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -758,8 +758,8 @@ Please refer to the :zephyr:code-sample:`logging-dictionary` sample to learn mor
758758
the log parser.
759759

760760

761-
Recommendations
762-
***************
761+
Recommendations and limitations
762+
*******************************
763763

764764
The are following recommendations:
765765

@@ -771,14 +771,19 @@ The are following recommendations:
771771
format specifier and it points to a constant string.
772772
* It is recommended to cast pointer to ``char *`` when it is used with ``%s``
773773
format specifier and it points to a transient string.
774-
* It is recommended to cast character pointer to non character pointer
774+
* It is required to cast a character pointer to non character pointer
775775
(e.g., ``void *``) when it is used with ``%p`` format specifier.
776776

777777
.. code-block:: c
778778
779779
LOG_WRN("%s", str);
780780
LOG_WRN("%p", (void *)str);
781781
782+
There are following limitations:
783+
784+
* Logging does not support string format specifier with width (e.g., ``%.*s`` or ``%8s``). That
785+
is because format string content is not used to build a log message, only argument types.
786+
782787
Benchmark
783788
*********
784789

0 commit comments

Comments
 (0)