Skip to content

Commit

Permalink
Merge branch 'docs/update_components_log_readme' into 'master'
Browse files Browse the repository at this point in the history
add description related to thread safety to component/log/readme

See merge request espressif/esp-idf!23162
  • Loading branch information
Lindazhxy committed Apr 23, 2023
2 parents 2fdba8e + 9ba5004 commit 2c24513
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions components/log/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Overview
The logging library provides two ways for setting log verbosity:

- **At compile time**: in menuconfig, set the verbosity level using the option :ref:`CONFIG_LOG_DEFAULT_LEVEL`.
- Optionally, also in menuconfig, set the maximum verbosity level using the option :ref:`CONFIG_LOG_MAXIMUM_LEVEL`. By default this is the same as the default level, but it can be set higher in order to compile more optional logs into the firmware.
- **At runtime**: all logs for verbosity levels lower than :ref:`CONFIG_LOG_DEFAULT_LEVEL` are enabled by default. The function :cpp:func:`esp_log_level_set` can be used to set a logging level on a per module basis. Modules are identified by their tags, which are human-readable ASCII zero-terminated strings.
- Optionally, also in menuconfig, set the maximum verbosity level using the option :ref:`CONFIG_LOG_MAXIMUM_LEVEL`. By default, this is the same as the default level, but it can be set higher in order to compile more optional logs into the firmware.
- **At runtime**: all logs for verbosity levels lower than :ref:`CONFIG_LOG_DEFAULT_LEVEL` are enabled by default. The function :cpp:func:`esp_log_level_set` can be used to set a logging level on a per-module basis. Modules are identified by their tags, which are human-readable ASCII zero-terminated strings.

There are the following verbosity levels:

Expand Down Expand Up @@ -86,3 +86,7 @@ Logging to Host via JTAG

By default, the logging library uses the vprintf-like function to write formatted output to the dedicated UART. By calling a simple API, all log output may be routed to JTAG instead, making logging several times faster. For details, please refer to Section :ref:`app_trace-logging-to-host`.

Thread Safety
^^^^^^^^^^^^^

The log string is first written into a memory buffer and then sent to the UART for printing. Log calls are thread-safe, i.e., logs of different threads do not conflict with each other.

0 comments on commit 2c24513

Please sign in to comment.