Select one of the symbols to view example projects that use it.
 
Outline
#include <stdint.h>
#include "esp_log_level.h"
esp_log_buffer_hex_internal(const char *, const void *, uint16_t, esp_log_level_t);
esp_log_buffer_char_internal(const char *, const void *, uint16_t, esp_log_level_t);
esp_log_buffer_hexdump_internal(const char *, const void *, uint16_t, esp_log_level_t);
esp_log_buffer_hex(const char *, const void *, uint16_t)
esp_log_buffer_char(const char *, const void *, uint16_t)
Files
loading...
SourceVuESP-IDF Framework and ExamplesESP-IDFcomponents/log/include/esp_log_buffer.h
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */ #pragma once #include <stdint.h> #include "esp_log_level.h" #ifdef __cplusplus extern "C" { #endif #if !NON_OS_BUILD || __DOXYGEN__ /** * @brief Logs a buffer of hexadecimal bytes at the specified log level. * * This function logs a buffer of hexadecimal bytes with 16 bytes per line. The * log level determines the severity of the log message. * * @note This function does not check the log level against the ESP_LOCAL_LEVEL. * The log level comparison should be done in esp_log.h. * * @param tag Description tag to identify the log. * @param buffer Pointer to the buffer array containing the data to be logged. * @param buff_len Length of the buffer in bytes. * @param level Log level indicating the severity of the log message. *//* ... */ void esp_log_buffer_hex_internal(const char *tag, const void *buffer, uint16_t buff_len, esp_log_level_t level); /** * @brief This function logs a buffer of characters with 16 characters per line. * The buffer should contain only printable characters. The log level determines * the severity of the log message. * * @note This function does not check the log level against the ESP_LOCAL_LEVEL. * The log level comparison should be done in esp_log.h. * * @param tag Description tag to identify the log. * @param buffer Pointer to the buffer array containing the data to be logged. * @param buff_len Length of the buffer in bytes. * @param level Log level indicating the severity of the log message. *//* ... */ void esp_log_buffer_char_internal(const char *tag, const void *buffer, uint16_t buff_len, esp_log_level_t level); /** * @brief This function dumps a buffer to the log in a formatted hex dump style, * displaying both the memory address and the corresponding hex and ASCII values * of the bytes. The log level determines the severity of the log message. * * @note This function does not check the log level against the ESP_LOCAL_LEVEL. * The log level comparison should be done in esp_log.h. * @note It is recommended to use terminals with a width of at least 102 * characters to display the log dump properly. * * @param tag Description tag to identify the log. * @param buffer Pointer to the buffer array containing the data to be logged. * @param buff_len Length of the buffer in bytes. * @param log_level Log level indicating the severity of the log message. *//* ... */ void esp_log_buffer_hexdump_internal(const char *tag, const void *buffer, uint16_t buff_len, esp_log_level_t log_level); /** * @brief Log a buffer of hex bytes at specified level, separated into 16 bytes each line. * * The hex log shows just like the one below: * * I (954) log_example: 54 68 65 20 77 61 79 20 74 6f 20 67 65 74 20 73 * I (962) log_example: 74 61 72 74 65 64 20 69 73 20 74 6f 20 71 75 69 * I (969) log_example: 74 20 74 61 6c 6b 69 6e 67 20 61 6e 64 20 62 65 * I (977) log_example: 67 69 6e 20 64 6f 69 6e 67 2e 20 2d 20 57 61 6c * I (984) log_example: 74 20 44 69 73 6e 65 79 00 * * @param tag Description tag to identify the log. * @param buffer Pointer to the buffer array containing the data to be logged. * @param buff_len Length of the buffer in bytes. * @param level Log level *//* ... */ #define ESP_LOG_BUFFER_HEX_LEVEL(tag, buffer, buff_len, level) \ do { if (LOG_LOCAL_LEVEL >= (level)) {esp_log_buffer_hex_internal(tag, buffer, buff_len, level);} } while(0)... /** * @brief Log a buffer of characters at specified level, separated into 16 bytes each line. Buffer should contain only printable characters. * * The char log shows just like the one below: * * I (980) log_example: The way to get s * I (985) log_example: tarted is to qui * I (989) log_example: t talking and be * I (994) log_example: gin doing. - Wal * I (999) log_example: t Disney * * @param tag Description tag to identify the log. * @param buffer Pointer to the buffer array containing the data to be logged. * @param buff_len Length of the buffer in bytes. * @param level Log level. * *//* ... */ #define ESP_LOG_BUFFER_CHAR_LEVEL(tag, buffer, buff_len, level) \ do { if (LOG_LOCAL_LEVEL >= (level)) {esp_log_buffer_char_internal(tag, buffer, buff_len, level);} } while(0)... /** * @brief Dump a buffer to the log at specified level. * * The dump log shows just like the one below: * * I (1013) log_example: 0x3ffb5bc0 54 68 65 20 77 61 79 20 74 6f 20 67 65 74 20 73 |The way to get s| * I (1024) log_example: 0x3ffb5bd0 74 61 72 74 65 64 20 69 73 20 74 6f 20 71 75 69 |tarted is to qui| * I (1034) log_example: 0x3ffb5be0 74 20 74 61 6c 6b 69 6e 67 20 61 6e 64 20 62 65 |t talking and be| * I (1044) log_example: 0x3ffb5bf0 67 69 6e 20 64 6f 69 6e 67 2e 20 2d 20 57 61 6c |gin doing. - Wal| * I (1054) log_example: 0x3ffb5c00 74 20 44 69 73 6e 65 79 00 |t Disney.| * * @note It is highly recommended to use terminals with over 102 text width. * * @param tag Description tag to identify the log. * @param buffer Pointer to the buffer array containing the data to be logged. * @param buff_len Length of the buffer in bytes. * @param level Log level. *//* ... */ #define ESP_LOG_BUFFER_HEXDUMP(tag, buffer, buff_len, level) \ do { if (LOG_LOCAL_LEVEL >= (level)) {esp_log_buffer_hexdump_internal(tag, buffer, buff_len, level);} } while(0)... /** * @brief Log a buffer of hex bytes at Info level * * @param tag Description tag to identify the log. * @param buffer Pointer to the buffer array containing the data to be logged. * @param buff_len Length of the buffer in bytes. * * @see ``ESP_LOG_BUFFER_HEX_LEVEL`` * *//* ... */ #define ESP_LOG_BUFFER_HEX(tag, buffer, buff_len) \ do { if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO) {ESP_LOG_BUFFER_HEX_LEVEL(tag, buffer, buff_len, ESP_LOG_INFO);} } while(0)... /** * @brief Log a buffer of characters at Info level. Buffer should contain only printable characters. * * @param tag Description tag to identify the log. * @param buffer Pointer to the buffer array containing the data to be logged. * @param buff_len Length of the buffer in bytes. * * @see ``ESP_LOG_BUFFER_CHAR_LEVEL`` * *//* ... */ #define ESP_LOG_BUFFER_CHAR(tag, buffer, buff_len) \ do { if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO) {ESP_LOG_BUFFER_CHAR_LEVEL(tag, buffer, buff_len, ESP_LOG_INFO);} } while(0)... 5 defines /** @cond */ /** * @note For back compatible * @deprecated This function is deprecated and will be removed in the future. * Please use ESP_LOG_BUFFER_HEX *//* ... */ __attribute__((deprecated("Use 'ESP_LOG_BUFFER_HEX' instead"))) static inline void esp_log_buffer_hex(const char *tag, const void *buffer, uint16_t buff_len) { ESP_LOG_BUFFER_HEX(tag, buffer, buff_len); }{ ... } /** * @note For back compatible * @deprecated This function is deprecated and will be removed in the future. * Please use ESP_LOG_BUFFER_CHAR *//* ... */ __attribute__((deprecated("Use 'ESP_LOG_BUFFER_CHAR' instead"))) static inline void esp_log_buffer_char(const char *tag, const void *buffer, uint16_t buff_len) { ESP_LOG_BUFFER_CHAR(tag, buffer, buff_len); }{ ... } /** @endcond */ /* ... */ #endif // !NON_OS_BUILD || __DOXYGEN__ #ifdef __cplusplus }{...} #endif
Details