1 /*
2  *  Copyright (c) 2016, The OpenThread Authors.
3  *  All rights reserved.
4  *
5  *  Redistribution and use in source and binary forms, with or without
6  *  modification, are permitted provided that the following conditions are met:
7  *  1. Redistributions of source code must retain the above copyright
8  *     notice, this list of conditions and the following disclaimer.
9  *  2. Redistributions in binary form must reproduce the above copyright
10  *     notice, this list of conditions and the following disclaimer in the
11  *     documentation and/or other materials provided with the distribution.
12  *  3. Neither the name of the copyright holder nor the
13  *     names of its contributors may be used to endorse or promote products
14  *     derived from this software without specific prior written permission.
15  *
16  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  *  POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 /**
30  * @file
31  *   This file includes logging related macro/function definitions.
32  */
33 
34 #ifndef LOGGING_HPP_
35 #define LOGGING_HPP_
36 
37 #include "openthread-core-config.h"
38 
39 #include <ctype.h>
40 #include <stdio.h>
41 
42 #include <openthread/logging.h>
43 #include <openthread/platform/logging.h>
44 
45 #include "common/arg_macros.hpp"
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
51 /**
52  * Log level prefix string definitions.
53  *
54  */
55 #if OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL
56 #define _OT_LEVEL_NONE_PREFIX "[NONE]"
57 #define _OT_LEVEL_CRIT_PREFIX "[CRIT]"
58 #define _OT_LEVEL_WARN_PREFIX "[WARN]"
59 #define _OT_LEVEL_NOTE_PREFIX "[NOTE]"
60 #define _OT_LEVEL_INFO_PREFIX "[INFO]"
61 #define _OT_LEVEL_DEBG_PREFIX "[DEBG]"
62 #define _OT_REGION_SUFFIX ": "
63 #else
64 #define _OT_LEVEL_NONE_PREFIX ""
65 #define _OT_LEVEL_CRIT_PREFIX ""
66 #define _OT_LEVEL_WARN_PREFIX ""
67 #define _OT_LEVEL_NOTE_PREFIX ""
68 #define _OT_LEVEL_INFO_PREFIX ""
69 #define _OT_LEVEL_DEBG_PREFIX ""
70 #define _OT_REGION_SUFFIX ""
71 #endif
72 
73 /**
74  * Log region prefix string definitions.
75  *
76  */
77 #if OPENTHREAD_CONFIG_LOG_PREPEND_REGION
78 #define _OT_REGION_API_PREFIX "-API-----: "
79 #define _OT_REGION_MLE_PREFIX "-MLE-----: "
80 #define _OT_REGION_ARP_PREFIX "-ARP-----: "
81 #define _OT_REGION_NET_DATA_PREFIX "-N-DATA--: "
82 #define _OT_REGION_ICMP_PREFIX "-ICMP----: "
83 #define _OT_REGION_IP6_PREFIX "-IP6-----: "
84 #define _OT_REGION_TCP_PREFIX "-TCP-----: "
85 #define _OT_REGION_MAC_PREFIX "-MAC-----: "
86 #define _OT_REGION_MEM_PREFIX "-MEM-----: "
87 #define _OT_REGION_NCP_PREFIX "-NCP-----: "
88 #define _OT_REGION_MESH_COP_PREFIX "-MESH-CP-: "
89 #define _OT_REGION_NET_DIAG_PREFIX "-DIAG----: "
90 #define _OT_REGION_PLATFORM_PREFIX "-PLAT----: "
91 #define _OT_REGION_COAP_PREFIX "-COAP----: "
92 #define _OT_REGION_CLI_PREFIX "-CLI-----: "
93 #define _OT_REGION_CORE_PREFIX "-CORE----: "
94 #define _OT_REGION_UTIL_PREFIX "-UTIL----: "
95 #define _OT_REGION_BBR_PREFIX "-BBR-----: "
96 #define _OT_REGION_MLR_PREFIX "-MLR-----: "
97 #define _OT_REGION_DUA_PREFIX "-DUA-----: "
98 #define _OT_REGION_BR_PREFIX "-BR------: "
99 #define _OT_REGION_SRP_PREFIX "-SRP-----: "
100 #define _OT_REGION_DNS_PREFIX "-DNS-----: "
101 
102 // When adding a new log region, please ensure to update the array
103 // `kRegionPrefixStrings[]` in `Log()` function in `logging.cpp`.
104 
105 #else
106 #define _OT_REGION_API_PREFIX _OT_REGION_SUFFIX
107 #define _OT_REGION_MLE_PREFIX _OT_REGION_SUFFIX
108 #define _OT_REGION_ARP_PREFIX _OT_REGION_SUFFIX
109 #define _OT_REGION_NET_DATA_PREFIX _OT_REGION_SUFFIX
110 #define _OT_REGION_ICMP_PREFIX _OT_REGION_SUFFIX
111 #define _OT_REGION_IP6_PREFIX _OT_REGION_SUFFIX
112 #define _OT_REGION_TCP_PREFIX _OT_REGION_PREFIX
113 #define _OT_REGION_MAC_PREFIX _OT_REGION_SUFFIX
114 #define _OT_REGION_MEM_PREFIX _OT_REGION_SUFFIX
115 #define _OT_REGION_NCP_PREFIX _OT_REGION_SUFFIX
116 #define _OT_REGION_MESH_COP_PREFIX _OT_REGION_SUFFIX
117 #define _OT_REGION_NET_DIAG_PREFIX _OT_REGION_SUFFIX
118 #define _OT_REGION_PLATFORM_PREFIX _OT_REGION_SUFFIX
119 #define _OT_REGION_COAP_PREFIX _OT_REGION_SUFFIX
120 #define _OT_REGION_CLI_PREFIX _OT_REGION_SUFFIX
121 #define _OT_REGION_CORE_PREFIX _OT_REGION_SUFFIX
122 #define _OT_REGION_UTIL_PREFIX _OT_REGION_SUFFIX
123 #define _OT_REGION_BBR_PREFIX _OT_REGION_SUFFIX
124 #define _OT_REGION_MLR_PREFIX _OT_REGION_SUFFIX
125 #define _OT_REGION_DUA_PREFIX _OT_REGION_SUFFIX
126 #define _OT_REGION_BR_PREFIX _OT_REGION_SUFFIX
127 #define _OT_REGION_SRP_PREFIX _OT_REGION_SUFFIX
128 #define _OT_REGION_DNS_PREFIX _OT_REGION_SUFFIX
129 #endif
130 
131 /**
132  * @def otLogCrit
133  *
134  * Logging at log level critical.
135  *
136  * @param[in]  aRegion   The log region.
137  * @param[in]  ...       Arguments for the format specification.
138  *
139  */
140 #if OPENTHREAD_CONFIG_LOG_LEVEL < OT_LOG_LEVEL_CRIT
141 #define otLogCrit(aRegion, aRegionPrefix, ...)
142 #elif OPENTHREAD_CONFIG_LOG_DEFINE_AS_MACRO_ONLY
143 #define otLogCrit(aRegion, aRegionPrefix, ...) \
144     _otLogFormatter(OT_LOG_LEVEL_CRIT, aRegion, _OT_LEVEL_CRIT_PREFIX aRegionPrefix __VA_ARGS__)
145 #else
146 #define otLogCrit(aRegion, aRegionPrefix, ...) _otLogCrit(aRegion, __VA_ARGS__)
147 void _otLogCrit(otLogRegion aRegion, const char *aFormat, ...);
148 #endif
149 
150 /**
151  * @def otLogWarn
152  *
153  * Logging at log level warning.
154  *
155  * @param[in]  aRegion   The log region.
156  * @param[in]  ...       Arguments for the format specification.
157  *
158  */
159 #if OPENTHREAD_CONFIG_LOG_LEVEL < OT_LOG_LEVEL_WARN
160 #define otLogWarn(aRegion, aRegionPrefix, ...)
161 #elif OPENTHREAD_CONFIG_LOG_DEFINE_AS_MACRO_ONLY
162 #define otLogWarn(aRegion, aRegionPrefix, ...) \
163     _otLogFormatter(OT_LOG_LEVEL_WARN, aRegion, _OT_LEVEL_WARN_PREFIX aRegionPrefix __VA_ARGS__)
164 #else
165 #define otLogWarn(aRegion, aRegionPrefix, ...) _otLogWarn(aRegion, __VA_ARGS__)
166 void _otLogWarn(otLogRegion aRegion, const char *aFormat, ...);
167 #endif
168 
169 /**
170  * @def otLogNote
171  *
172  * Logging at log level note
173  *
174  * @param[in]  aRegion   The log region.
175  * @param[in]  ...       Arguments for the format specification.
176  *
177  */
178 #if OPENTHREAD_CONFIG_LOG_LEVEL < OT_LOG_LEVEL_NOTE
179 #define otLogNote(aRegion, aRegionPrefix, ...)
180 #elif OPENTHREAD_CONFIG_LOG_DEFINE_AS_MACRO_ONLY
181 #define otLogNote(aRegion, aRegionPrefix, ...) \
182     _otLogFormatter(OT_LOG_LEVEL_NOTE, aRegion, _OT_LEVEL_NOTE_PREFIX aRegionPrefix __VA_ARGS__)
183 #else
184 #define otLogNote(aRegion, aRegionPrefix, ...) _otLogNote(aRegion, __VA_ARGS__)
185 void _otLogNote(otLogRegion aRegion, const char *aFormat, ...);
186 #endif
187 
188 /**
189  * @def otLogInfo
190  *
191  * Logging at log level info.
192  *
193  * @param[in]  aRegion   The log region.
194  * @param[in]  ...       Arguments for the format specification.
195  *
196  */
197 #if OPENTHREAD_CONFIG_LOG_LEVEL < OT_LOG_LEVEL_INFO
198 #define otLogInfo(aRegion, aRegionPrefix, ...)
199 #elif OPENTHREAD_CONFIG_LOG_DEFINE_AS_MACRO_ONLY
200 #define otLogInfo(aRegion, aRegionPrefix, ...) \
201     _otLogFormatter(OT_LOG_LEVEL_INFO, aRegion, _OT_LEVEL_INFO_PREFIX aRegionPrefix __VA_ARGS__)
202 #else
203 #define otLogInfo(aRegion, aRegionPrefix, ...) _otLogInfo(aRegion, __VA_ARGS__)
204 void _otLogInfo(otLogRegion aRegion, const char *aFormat, ...);
205 #endif
206 
207 /**
208  * @def otLogDebg
209  *
210  * Logging at log level debug.
211  *
212  * @param[in]  aRegion   The log region.
213  * @param[in]  ...       Arguments for the format specification.
214  *
215  */
216 #if OPENTHREAD_CONFIG_LOG_LEVEL < OT_LOG_LEVEL_DEBG
217 #define otLogDebg(aRegion, aRegionPrefix, ...)
218 #elif OPENTHREAD_CONFIG_LOG_DEFINE_AS_MACRO_ONLY
219 #define otLogDebg(aRegion, aRegionPrefix, ...) \
220     _otLogFormatter(OT_LOG_LEVEL_DEBG, aRegion, _OT_LEVEL_DEBG_PREFIX aRegionPrefix __VA_ARGS__)
221 #else
222 #define otLogDebg(aRegion, aRegionPrefix, ...) _otLogDebg(aRegion, __VA_ARGS__)
223 void _otLogDebg(otLogRegion aRegion, const char *aFormat, ...);
224 #endif
225 
226 /**
227  * @def otLogCritApi
228  *
229  * This function generates a log with level critical for the API region.
230  *
231  * @param[in]  ...  Arguments for the format specification.
232  *
233  */
234 
235 /**
236  * @def otLogWarnApi
237  *
238  * This function generates a log with level warning for the API region.
239  *
240  * @param[in]  ...  Arguments for the format specification.
241  *
242  */
243 
244 /**
245  * @def otLogNoteApi
246  *
247  * This function generates a log with level note for the API region.
248  *
249  * @param[in]  ...  Arguments for the format specification.
250  *
251  */
252 
253 /**
254  * @def otLogInfoApi
255  *
256  * This function generates a log with level info for the API region.
257  *
258  * @param[in]  ...  Arguments for the format specification.
259  *
260  */
261 
262 /**
263  * @def otLogDebgApi
264  *
265  * This function generates a log with level debug for the API region.
266  *
267  * @param[in]  ...  Arguments for the format specification.
268  *
269  */
270 #if OPENTHREAD_CONFIG_LOG_API
271 #define otLogCritApi(...) otLogCrit(OT_LOG_REGION_API, _OT_REGION_API_PREFIX, __VA_ARGS__)
272 #define otLogWarnApi(...) otLogWarn(OT_LOG_REGION_API, _OT_REGION_API_PREFIX, __VA_ARGS__)
273 #define otLogNoteApi(...) otLogNote(OT_LOG_REGION_API, _OT_REGION_API_PREFIX, __VA_ARGS__)
274 #define otLogInfoApi(...) otLogInfo(OT_LOG_REGION_API, _OT_REGION_API_PREFIX, __VA_ARGS__)
275 #define otLogDebgApi(...) otLogDebg(OT_LOG_REGION_API, _OT_REGION_API_PREFIX, __VA_ARGS__)
276 #else
277 #define otLogCritApi(...)
278 #define otLogWarnApi(...)
279 #define otLogNoteApi(...)
280 #define otLogInfoApi(...)
281 #define otLogDebgApi(...)
282 #endif
283 
284 /**
285  * @def otLogCritMeshCoP
286  *
287  * This function generates a log with level critical for the MeshCoP region.
288  *
289  * @param[in]  ...  Arguments for the format specification.
290  *
291  *
292  */
293 
294 /**
295  * @def otLogWarnMeshCoP
296  *
297  * This function generates a log with level warning for the MeshCoP region.
298  *
299  * @param[in]  ...  Arguments for the format specification.
300  *
301  */
302 
303 /**
304  * @def otLogNoteMeshCoP
305  *
306  * This function generates a log with level note for the MeshCoP region.
307  *
308  * @param[in]  ...  Arguments for the format specification.
309  *
310  */
311 
312 /**
313  * @def otLogInfoMeshCoP
314  *
315  * This function generates a log with level info for the MeshCoP region.
316  *
317  * @param[in]  ...  Arguments for the format specification.
318  *
319  */
320 
321 /**
322  * @def otLogDebgMeshCoP
323  *
324  * This function generates a log with level debug for the MeshCoP region.
325  *
326  * @param[in]  ...  Arguments for the format specification.
327  *
328  */
329 #if OPENTHREAD_CONFIG_LOG_MESHCOP
330 #define otLogCritMeshCoP(...) otLogCrit(OT_LOG_REGION_MESH_COP, _OT_REGION_MESH_COP_PREFIX, __VA_ARGS__)
331 #define otLogWarnMeshCoP(...) otLogWarn(OT_LOG_REGION_MESH_COP, _OT_REGION_MESH_COP_PREFIX, __VA_ARGS__)
332 #define otLogNoteMeshCoP(...) otLogNote(OT_LOG_REGION_MESH_COP, _OT_REGION_MESH_COP_PREFIX, __VA_ARGS__)
333 #define otLogInfoMeshCoP(...) otLogInfo(OT_LOG_REGION_MESH_COP, _OT_REGION_MESH_COP_PREFIX, __VA_ARGS__)
334 #define otLogDebgMeshCoP(...) otLogDebg(OT_LOG_REGION_MESH_COP, _OT_REGION_MESH_COP_PREFIX, __VA_ARGS__)
335 #else
336 #define otLogCritMeshCoP(...)
337 #define otLogWarnMeshCoP(...)
338 #define otLogNoteMeshCoP(...)
339 #define otLogInfoMeshCoP(...)
340 #define otLogDebgMeshCoP(...)
341 #endif
342 
343 #define otLogCritMbedTls(...) otLogCritMeshCoP(__VA_ARGS__)
344 #define otLogWarnMbedTls(...) otLogWarnMeshCoP(__VA_ARGS__)
345 #define otLogNoteMbedTls(...) otLogNoteMeshCoP(__VA_ARGS__)
346 #define otLogInfoMbedTls(...) otLogInfoMeshCoP(__VA_ARGS__)
347 #define otLogDebgMbedTls(...) otLogDebgMeshCoP(__VA_ARGS__)
348 
349 /**
350  * @def otLogCritBr
351  *
352  * This function generates a log with level critical for the BR region.
353  *
354  * @param[in]  ...  Arguments for the format specification.
355  *
356  */
357 
358 /**
359  * @def otLogWarnBr
360  *
361  * This function generates a log with level warning for the BR region.
362  *
363  * @param[in]  ...  Arguments for the format specification.
364  *
365  */
366 
367 /**
368  * @def otLogNoteBr
369  *
370  * This function generates a log with level note for the BR region.
371  *
372  * @param[in]  ...  Arguments for the format specification.
373  *
374  */
375 
376 /**
377  * @def otLogInfoBr
378  *
379  * This function generates a log with level info for the BR region.
380  *
381  * @param[in]  ...  Arguments for the format specification.
382  *
383  */
384 
385 /**
386  * @def otLogDebgBr
387  *
388  * This function generates a log with level debug for the BR region.
389  *
390  * @param[in]  ...  Arguments for the format specification.
391  *
392  */
393 #if OPENTHREAD_CONFIG_LOG_BR
394 #define otLogCritBr(...) otLogCrit(OT_LOG_REGION_BR, _OT_REGION_BR_PREFIX, __VA_ARGS__)
395 #define otLogWarnBr(...) otLogWarn(OT_LOG_REGION_BR, _OT_REGION_BR_PREFIX, __VA_ARGS__)
396 #define otLogNoteBr(...) otLogNote(OT_LOG_REGION_BR, _OT_REGION_BR_PREFIX, __VA_ARGS__)
397 #define otLogInfoBr(...) otLogInfo(OT_LOG_REGION_BR, _OT_REGION_BR_PREFIX, __VA_ARGS__)
398 #define otLogDebgBr(...) otLogDebg(OT_LOG_REGION_BR, _OT_REGION_BR_PREFIX, __VA_ARGS__)
399 #else
400 #define otLogCritBr(...)
401 #define otLogWarnBr(...)
402 #define otLogNoteBr(...)
403 #define otLogInfoBr(...)
404 #define otLogDebgBr(...)
405 #endif
406 
407 /**
408  * @def otLogCritMle
409  *
410  * This function generates a log with level critical for the MLE region.
411  *
412  * @param[in]  ...  Arguments for the format specification.
413  *
414  */
415 
416 /**
417  * @def otLogWarnMle
418  *
419  * This function generates a log with level warning for the MLE region.
420  *
421  * @param[in]  ...  Arguments for the format specification.
422  *
423  */
424 
425 /**
426  * @def otLogNoteMle
427  *
428  * This function generates a log with level note for the MLE region.
429  *
430  * @param[in]  ...  Arguments for the format specification.
431  *
432  */
433 
434 /**
435  * @def otLogInfoMle
436  *
437  * This function generates a log with level info for the MLE region.
438  *
439  * @param[in]  ...  Arguments for the format specification.
440  *
441  */
442 
443 /**
444  * @def otLogDebgMle
445  *
446  * This function generates a log with level debug for the MLE region.
447  *
448  * @param[in]  ...  Arguments for the format specification.
449  *
450  *
451  */
452 #if OPENTHREAD_CONFIG_LOG_MLE
453 #define otLogCritMle(...) otLogCrit(OT_LOG_REGION_MLE, _OT_REGION_MLE_PREFIX, __VA_ARGS__)
454 #define otLogWarnMle(...) otLogWarn(OT_LOG_REGION_MLE, _OT_REGION_MLE_PREFIX, __VA_ARGS__)
455 #define otLogNoteMle(...) otLogNote(OT_LOG_REGION_MLE, _OT_REGION_MLE_PREFIX, __VA_ARGS__)
456 #define otLogInfoMle(...) otLogInfo(OT_LOG_REGION_MLE, _OT_REGION_MLE_PREFIX, __VA_ARGS__)
457 #define otLogDebgMle(...) otLogDebg(OT_LOG_REGION_MLE, _OT_REGION_MLE_PREFIX, __VA_ARGS__)
458 #else
459 #define otLogCritMle(...)
460 #define otLogWarnMle(...)
461 #define otLogNoteMle(...)
462 #define otLogInfoMle(...)
463 #define otLogDebgMle(...)
464 #endif
465 
466 /**
467  * @def otLogCritArp
468  *
469  * This function generates a log with level critical for the EID-to-RLOC mapping region.
470  *
471  * @param[in]  ...  Arguments for the format specification.
472  *
473  */
474 
475 /**
476  * @def otLogWarnArp
477  *
478  * This function generates a log with level warning for the EID-to-RLOC mapping region.
479  *
480  * @param[in]  ...  Arguments for the format specification.
481  *
482  */
483 
484 /**
485  * @def otLogNoteArp
486  *
487  * This function generates a log with level note for the EID-to-RLOC mapping region.
488  *
489  * @param[in]  ...  Arguments for the format specification.
490  *
491  */
492 
493 /**
494  * @def otLogInfoArp
495  *
496  * This function generates a log with level info for the EID-to-RLOC mapping region.
497  *
498  * @param[in]  ...  Arguments for the format specification.
499  *
500  */
501 
502 /**
503  * @def otLogDebgArp
504  *
505  * This function generates a log with level debug for the EID-to-RLOC mapping region.
506  *
507  * @param[in]  ...  Arguments for the format specification.
508  *
509  */
510 #if OPENTHREAD_CONFIG_LOG_ARP
511 #define otLogCritArp(...) otLogCrit(OT_LOG_REGION_ARP, _OT_REGION_ARP_PREFIX, __VA_ARGS__)
512 #define otLogWarnArp(...) otLogWarn(OT_LOG_REGION_ARP, _OT_REGION_ARP_PREFIX, __VA_ARGS__)
513 #define otLogNoteArp(...) otLogNote(OT_LOG_REGION_ARP, _OT_REGION_ARP_PREFIX, __VA_ARGS__)
514 #define otLogInfoArp(...) otLogInfo(OT_LOG_REGION_ARP, _OT_REGION_ARP_PREFIX, __VA_ARGS__)
515 #define otLogDebgArp(...) otLogDebg(OT_LOG_REGION_ARP, _OT_REGION_ARP_PREFIX, __VA_ARGS__)
516 #else
517 #define otLogCritArp(...)
518 #define otLogWarnArp(...)
519 #define otLogNoteArp(...)
520 #define otLogInfoArp(...)
521 #define otLogDebgArp(...)
522 #endif
523 
524 /**
525  * @def otLogCritBbr
526  *
527  * This function generates a log with level critical for the Backbone Router (BBR) region.
528  *
529  * @param[in]  ...  Arguments for the format specification.
530  *
531  */
532 
533 /**
534  * @def otLogWarnBbr
535  *
536  * This function generates a log with level warning for the Backbone Router (BBR) region.
537  *
538  * @param[in]  ...  Arguments for the format specification.
539  *
540  */
541 
542 /**
543  * @def otLogNoteBbr
544  *
545  * This function generates a log with level note for the Backbone Router (BBR) region.
546  *
547  * @param[in]  ...  Arguments for the format specification.
548  *
549  */
550 
551 /**
552  * @def otLogInfoBbr
553  *
554  * This function generates a log with level info for the Backbone Router (BBR) region.
555  *
556  * @param[in]  ...  Arguments for the format specification.
557  *
558  */
559 
560 /**
561  * @def otLogDebgBbr
562  *
563  * This function generates a log with level debug for the Backbone Router (BBR) region.
564  *
565  * @param[in]  ...  Arguments for the format specification.
566  *
567  */
568 #if OPENTHREAD_CONFIG_LOG_BBR
569 #define otLogCritBbr(...) otLogCrit(OT_LOG_REGION_BBR, _OT_REGION_BBR_PREFIX, __VA_ARGS__)
570 #define otLogWarnBbr(...) otLogWarn(OT_LOG_REGION_BBR, _OT_REGION_BBR_PREFIX, __VA_ARGS__)
571 #define otLogNoteBbr(...) otLogNote(OT_LOG_REGION_BBR, _OT_REGION_BBR_PREFIX, __VA_ARGS__)
572 #define otLogInfoBbr(...) otLogInfo(OT_LOG_REGION_BBR, _OT_REGION_BBR_PREFIX, __VA_ARGS__)
573 #define otLogDebgBbr(...) otLogDebg(OT_LOG_REGION_BBR, _OT_REGION_BBR_PREFIX, __VA_ARGS__)
574 #else
575 #define otLogCritBbr(...)
576 #define otLogWarnBbr(...)
577 #define otLogNoteBbr(...)
578 #define otLogInfoBbr(...)
579 #define otLogDebgBbr(...)
580 #endif
581 
582 /**
583  * @def otLogCritMlr
584  *
585  * This function generates a log with level critical for the Multicast Listener Registration (MLR) region.
586  *
587  * @param[in]  ...  Arguments for the format specification.
588  *
589  */
590 
591 /**
592  * @def otLogWarnMlr
593  *
594  * This function generates a log with level warning for the Multicast Listener Registration (MLR) region.
595  *
596  * @param[in]  ...  Arguments for the format specification.
597  *
598  */
599 
600 /**
601  * @def otLogNoteMlr
602  *
603  * This function generates a log with level note for the Multicast Listener Registration (MLR) region.
604  *
605  * @param[in]  ...  Arguments for the format specification.
606  *
607  */
608 
609 /**
610  * @def otLogInfoMlr
611  *
612  * This function generates a log with level info for the Multicast Listener Registration (MLR) region.
613  *
614  * @param[in]  ...  Arguments for the format specification.
615  *
616  */
617 
618 /**
619  * @def otLogDebgMlr
620  *
621  * This function generates a log with level debug for the Multicast Listener Registration (MLR) region.
622  *
623  * @param[in]  ...  Arguments for the format specification.
624  *
625  */
626 #if OPENTHREAD_CONFIG_LOG_MLR
627 #define otLogCritMlr(...) otLogCrit(OT_LOG_REGION_MLR, _OT_REGION_MLR_PREFIX, __VA_ARGS__)
628 #define otLogWarnMlr(...) otLogWarn(OT_LOG_REGION_MLR, _OT_REGION_MLR_PREFIX, __VA_ARGS__)
629 #define otLogNoteMlr(...) otLogNote(OT_LOG_REGION_MLR, _OT_REGION_MLR_PREFIX, __VA_ARGS__)
630 #define otLogInfoMlr(...) otLogInfo(OT_LOG_REGION_MLR, _OT_REGION_MLR_PREFIX, __VA_ARGS__)
631 #define otLogDebgMlr(...) otLogDebg(OT_LOG_REGION_MLR, _OT_REGION_MLR_PREFIX, __VA_ARGS__)
632 #else
633 #define otLogCritMlr(...)
634 #define otLogWarnMlr(...)
635 #define otLogNoteMlr(...)
636 #define otLogInfoMlr(...)
637 #define otLogDebgMlr(...)
638 #endif
639 
640 /**
641  * @def otLogCritNetData
642  *
643  * This function generates a log with level critical for the Network Data region.
644  *
645  * @param[in]  ...  Arguments for the format specification.
646  *
647  */
648 
649 /**
650  * @def otLogWarnNetData
651  *
652  * This function generates a log with level warning for the Network Data region.
653  *
654  * @param[in]  ...  Arguments for the format specification.
655  *
656  */
657 
658 /**
659  * @def otLogNoteNetData
660  *
661  * This function generates a log with level note for the Network Data region.
662  *
663  * @param[in]  ...  Arguments for the format specification.
664  *
665  */
666 
667 /**
668  * @def otLogInfoNetData
669  *
670  * This function generates a log with level info for the Network Data region.
671  *
672  * @param[in]  ...  Arguments for the format specification.
673  *
674  */
675 
676 /**
677  * @def otLogDebgNetData
678  *
679  * This function generates a log with level debug for the Network Data region.
680  *
681  * @param[in]  ...  Arguments for the format specification.
682  *
683  */
684 #if OPENTHREAD_CONFIG_LOG_NETDATA
685 #define otLogCritNetData(...) otLogCrit(OT_LOG_REGION_NET_DATA, _OT_REGION_NET_DATA_PREFIX, __VA_ARGS__)
686 #define otLogWarnNetData(...) otLogWarn(OT_LOG_REGION_NET_DATA, _OT_REGION_NET_DATA_PREFIX, __VA_ARGS__)
687 #define otLogNoteNetData(...) otLogNote(OT_LOG_REGION_NET_DATA, _OT_REGION_NET_DATA_PREFIX, __VA_ARGS__)
688 #define otLogInfoNetData(...) otLogInfo(OT_LOG_REGION_NET_DATA, _OT_REGION_NET_DATA_PREFIX, __VA_ARGS__)
689 #define otLogDebgNetData(...) otLogDebg(OT_LOG_REGION_NET_DATA, _OT_REGION_NET_DATA_PREFIX, __VA_ARGS__)
690 #else
691 #define otLogCritNetData(...)
692 #define otLogWarnNetData(...)
693 #define otLogNoteNetData(...)
694 #define otLogInfoNetData(...)
695 #define otLogDebgNetData(...)
696 #endif
697 
698 /**
699  * @def otLogCritIcmp
700  *
701  * This function generates a log with level critical for the ICMPv6 region.
702  *
703  * @param[in]  ...  Arguments for the format specification.
704  *
705  */
706 
707 /**
708  * @def otLogWarnIcmp
709  *
710  * This function generates a log with level warning for the ICMPv6 region.
711  *
712  * @param[in]  ...  Arguments for the format specification.
713  *
714  */
715 
716 /**
717  * @def otLogNoteIcmp
718  *
719  * This function generates a log with level note for the ICMPv6 region.
720  *
721  * @param[in]  ...  Arguments for the format specification.
722  *
723  */
724 
725 /**
726  * @def otLogInfoIcmp
727  *
728  * This function generates a log with level info for the ICMPv6 region.
729  *
730  * @param[in]  ...  Arguments for the format specification.
731  *
732  */
733 
734 /**
735  * @def otLogDebgIcmp
736  *
737  * This function generates a log with level debug for the ICMPv6 region.
738  *
739  * @param[in]  ...  Arguments for the format specification.
740  *
741  */
742 #if OPENTHREAD_CONFIG_LOG_ICMP
743 #define otLogCritIcmp(...) otLogCrit(OT_LOG_REGION_ICMP, _OT_REGION_ICMP_PREFIX, __VA_ARGS__)
744 #define otLogWarnIcmp(...) otLogWarn(OT_LOG_REGION_ICMP, _OT_REGION_ICMP_PREFIX, __VA_ARGS__)
745 #define otLogNoteIcmp(...) otLogNote(OT_LOG_REGION_ICMP, _OT_REGION_ICMP_PREFIX, __VA_ARGS__)
746 #define otLogInfoIcmp(...) otLogInfo(OT_LOG_REGION_ICMP, _OT_REGION_ICMP_PREFIX, __VA_ARGS__)
747 #define otLogDebgIcmp(...) otLogDebg(OT_LOG_REGION_ICMP, _OT_REGION_ICMP_PREFIX, __VA_ARGS__)
748 #else
749 #define otLogCritIcmp(...)
750 #define otLogWarnIcmp(...)
751 #define otLogNoteIcmp(...)
752 #define otLogInfoIcmp(...)
753 #define otLogDebgIcmp(...)
754 #endif
755 
756 /**
757  * @def otLogCritIp6
758  *
759  * This function generates a log with level critical for the IPv6 region.
760  *
761  * @param[in]  ...  Arguments for the format specification.
762  *
763  */
764 
765 /**
766  * @def otLogWarnIp6
767  *
768  * This function generates a log with level warning for the IPv6 region.
769  *
770  * @param[in]  ...  Arguments for the format specification.
771  *
772  */
773 
774 /**
775  * @def otLogNoteIp6
776  *
777  * This function generates a log with level note for the IPv6 region.
778  *
779  * @param[in]  ...  Arguments for the format specification.
780  *
781  */
782 
783 /**
784  * @def otLogInfoIp6
785  *
786  * This function generates a log with level info for the IPv6 region.
787  *
788  * @param[in]  ...  Arguments for the format specification.
789  *
790  */
791 
792 /**
793  * @def otLogDebgIp6
794  *
795  * This function generates a log with level debug for the IPv6 region.
796  *
797  * @param[in]  ...  Arguments for the format specification.
798  *
799  */
800 #if OPENTHREAD_CONFIG_LOG_IP6
801 #define otLogCritIp6(...) otLogCrit(OT_LOG_REGION_IP6, _OT_REGION_IP6_PREFIX, __VA_ARGS__)
802 #define otLogWarnIp6(...) otLogWarn(OT_LOG_REGION_IP6, _OT_REGION_IP6_PREFIX, __VA_ARGS__)
803 #define otLogNoteIp6(...) otLogNote(OT_LOG_REGION_IP6, _OT_REGION_IP6_PREFIX, __VA_ARGS__)
804 #define otLogInfoIp6(...) otLogInfo(OT_LOG_REGION_IP6, _OT_REGION_IP6_PREFIX, __VA_ARGS__)
805 #define otLogDebgIp6(...) otLogDebg(OT_LOG_REGION_IP6, _OT_REGION_IP6_PREFIX, __VA_ARGS__)
806 #else
807 #define otLogCritIp6(...)
808 #define otLogWarnIp6(...)
809 #define otLogNoteIp6(...)
810 #define otLogInfoIp6(...)
811 #define otLogDebgIp6(...)
812 #endif
813 
814 /**
815  * @def otLogCritTcp
816  *
817  * This function generates a log with level critical for the TCP region.
818  *
819  * @param[in]  ...  Arguments for the format specification.
820  *
821  */
822 
823 /**
824  * @def otLogWarnTcp
825  *
826  * This function generates a log with level warning for the TCP region.
827  *
828  * @param[in]  ...  Arguments for the format specification.
829  *
830  */
831 
832 /**
833  * @def otLogNoteTcp
834  *
835  * This function generates a log with level note for the TCP region.
836  *
837  * @param[in]  ...  Arguments for the format specification.
838  *
839  */
840 
841 /**
842  * @def otLogInfoTcp
843  *
844  * This function generates a log with level info for the TCP region.
845  *
846  * @param[in]  ...  Arguments for the format specification.
847  *
848  */
849 
850 /**
851  * @def otLogDebgTcp
852  *
853  * This function generates a log with level debug for the TCP region.
854  *
855  * @param[in]  ...  Arguments for the format specification.
856  *
857  */
858 #if OPENTHREAD_CONFIG_LOG_TCP
859 #define otLogCritTcp(...) otLogCrit(OT_LOG_REGION_TCP, _OT_REGION_TCP_PREFIX, __VA_ARGS__)
860 #define otLogWarnTcp(...) otLogWarn(OT_LOG_REGION_TCP, _OT_REGION_TCP_PREFIX, __VA_ARGS__)
861 #define otLogNoteTcp(...) otLogNote(OT_LOG_REGION_TCP, _OT_REGION_TCP_PREFIX, __VA_ARGS__)
862 #define otLogInfoTcp(...) otLogInfo(OT_LOG_REGION_TCP, _OT_REGION_TCP_PREFIX, __VA_ARGS__)
863 #define otLogDebgTcp(...) otLogDebg(OT_LOG_REGION_TCP, _OT_REGION_TCP_PREFIX, __VA_ARGS__)
864 #else
865 #define otLogCritTcp(...)
866 #define otLogWarnTcp(...)
867 #define otLogNoteTcp(...)
868 #define otLogInfoTcp(...)
869 #define otLogDebgTcp(...)
870 #endif
871 
872 /**
873  * @def otLogCritMac
874  *
875  * This function generates a log with level critical for the MAC region.
876  *
877  * @param[in]  ...  Arguments for the format specification.
878  *
879  */
880 
881 /**
882  * @def otLogWarnMac
883  *
884  * This function generates a log with level warning for the MAC region.
885  *
886  * @param[in]  ...  Arguments for the format specification.
887  *
888  */
889 
890 /**
891  * @def otLogNoteMac
892  *
893  * This function generates a log with level note for the MAC region.
894  *
895  * @param[in]  ...  Arguments for the format specification.
896  *
897  */
898 
899 /**
900  * @def otLogInfoMac
901  *
902  * This function generates a log with level info for the MAC region.
903  *
904  * @param[in]  ...  Arguments for the format specification.
905  *
906  */
907 
908 /**
909  * @def otLogDebgMac
910  *
911  * This function generates a log with level debug for the MAC region.
912  *
913  * @param[in]  ...  Arguments for the format specification.
914  *
915  */
916 
917 /**
918  * @def otLogMac
919  *
920  * This function generates a log with a given log level for the MAC region.
921  *
922  * @param[in]  aLogLevel  A log level.
923  * @param[in]  aFormat    A pointer to the format string.
924  * @param[in]  ...        Arguments for the format specification.
925  *
926  */
927 #if OPENTHREAD_CONFIG_LOG_MAC
928 #define otLogCritMac(...) otLogCrit(OT_LOG_REGION_MAC, _OT_REGION_MAC_PREFIX, __VA_ARGS__)
929 #define otLogWarnMac(...) otLogWarn(OT_LOG_REGION_MAC, _OT_REGION_MAC_PREFIX, __VA_ARGS__)
930 #define otLogNoteMac(...) otLogNote(OT_LOG_REGION_MAC, _OT_REGION_MAC_PREFIX, __VA_ARGS__)
931 #define otLogInfoMac(...) otLogInfo(OT_LOG_REGION_MAC, _OT_REGION_MAC_PREFIX, __VA_ARGS__)
932 #define otLogDebgMac(...) otLogDebg(OT_LOG_REGION_MAC, _OT_REGION_MAC_PREFIX, __VA_ARGS__)
933 #if OPENTHREAD_CONFIG_LOG_DEFINE_AS_MACRO_ONLY
934 #define otLogMac(aLogLevel, aFormat, ...)                                                     \
935     do                                                                                        \
936     {                                                                                         \
937         if (otLoggingGetLevel() >= aLogLevel)                                                 \
938         {                                                                                     \
939             _otLogFormatter(aLogLevel, OT_LOG_REGION_MAC, "%s" _OT_REGION_MAC_PREFIX aFormat, \
940                             otLogLevelToPrefixString(aLogLevel), __VA_ARGS__);                \
941         }                                                                                     \
942     } while (false)
943 #else
944 void otLogMac(otLogLevel aLogLevel, const char *aFormat, ...);
945 #endif
946 #else
947 #define otLogCritMac(...)
948 #define otLogWarnMac(...)
949 #define otLogNoteMac(...)
950 #define otLogInfoMac(...)
951 #define otLogDebgMac(...)
952 #define otLogMac(aLogLevel, ...)
953 #endif
954 
955 /**
956  * @def otLogCritCore
957  *
958  * This function generates a log with level critical for the Core region.
959  *
960  * @param[in]  ...  Arguments for the format specification.
961  *
962  */
963 
964 /**
965  * @def otLogWarnCore
966  *
967  * This function generates a log with level warning for the Core region.
968  *
969  * @param[in]  ...  Arguments for the format specification.
970  *
971  */
972 
973 /**
974  * @def otLogNoteCore
975  *
976  * This function generates a log with level note for the Core region.
977  *
978  * @param[in]  ...  Arguments for the format specification.
979  *
980  */
981 
982 /**
983  * @def otLogInfoCore
984  *
985  * This function generates a log with level info for the Core region.
986  *
987  * @param[in]  ...  Arguments for the format specification.
988  *
989  */
990 
991 /**
992  * @def otLogDebgCore
993  *
994  * This function generates a log with level debug for the Core region.
995  *
996  * @param[in]  ...  Arguments for the format specification.
997  *
998  */
999 #if OPENTHREAD_CONFIG_LOG_CORE
1000 #define otLogCritCore(...) otLogCrit(OT_LOG_REGION_CORE, _OT_REGION_CORE_PREFIX, __VA_ARGS__)
1001 #define otLogWarnCore(...) otLogWarn(OT_LOG_REGION_CORE, _OT_REGION_CORE_PREFIX, __VA_ARGS__)
1002 #define otLogNoteCore(...) otLogNote(OT_LOG_REGION_CORE, _OT_REGION_CORE_PREFIX, __VA_ARGS__)
1003 #define otLogInfoCore(...) otLogInfo(OT_LOG_REGION_CORE, _OT_REGION_CORE_PREFIX, __VA_ARGS__)
1004 #define otLogDebgCore(...) otLogDebg(OT_LOG_REGION_CORE, _OT_REGION_CORE_PREFIX, __VA_ARGS__)
1005 #else
1006 #define otLogCritCore(...)
1007 #define otLogWarnCore(...)
1008 #define otLogInfoCore(...)
1009 #define otLogDebgCore(...)
1010 #endif
1011 
1012 /**
1013  * @def otLogCritMem
1014  *
1015  * This function generates a log with level critical for the memory region.
1016  *
1017  * @param[in]  ...  Arguments for the format specification.
1018  *
1019  */
1020 
1021 /**
1022  * @def otLogWarnMem
1023  *
1024  * This function generates a log with level warning for the memory region.
1025  *
1026  * @param[in]  ...  Arguments for the format specification.
1027  *
1028  */
1029 
1030 /**
1031  * @def otLogNoteMem
1032  *
1033  * This function generates a log with level note for the memory region.
1034  *
1035  * @param[in]  ...  Arguments for the format specification.
1036  *
1037  */
1038 
1039 /**
1040  * @def otLogInfoMem
1041  *
1042  * This function generates a log with level info for the memory region.
1043  *
1044  * @param[in]  ...  Arguments for the format specification.
1045  *
1046  */
1047 
1048 /**
1049  * @def otLogDebgMem
1050  *
1051  * This function generates a log with level debug for the memory region.
1052  *
1053  * @param[in]  ...  Arguments for the format specification.
1054  *
1055  */
1056 #if OPENTHREAD_CONFIG_LOG_MEM
1057 #define otLogCritMem(...) otLogCrit(OT_LOG_REGION_MEM, _OT_REGION_MEM_PREFIX, __VA_ARGS__)
1058 #define otLogWarnMem(...) otLogWarn(OT_LOG_REGION_MEM, _OT_REGION_MEM_PREFIX, __VA_ARGS__)
1059 #define otLogNoteMem(...) otLogNote(OT_LOG_REGION_MEM, _OT_REGION_MEM_PREFIX, __VA_ARGS__)
1060 #define otLogInfoMem(...) otLogInfo(OT_LOG_REGION_MEM, _OT_REGION_MEM_PREFIX, __VA_ARGS__)
1061 #define otLogDebgMem(...) otLogDebg(OT_LOG_REGION_MEM, _OT_REGION_MEM_PREFIX, __VA_ARGS__)
1062 #else
1063 #define otLogCritMem(...)
1064 #define otLogWarnMem(...)
1065 #define otLogNoteMem(...)
1066 #define otLogInfoMem(...)
1067 #define otLogDebgMem(...)
1068 #endif
1069 
1070 /**
1071  * @def otLogCritUtil
1072  *
1073  * This function generates a log with level critical for the Util region.
1074  *
1075  * @param[in]  ...  Arguments for the format specification.
1076  *
1077  */
1078 
1079 /**
1080  * @def otLogWarnUtil
1081  *
1082  * This function generates a log with level warning for the Util region.
1083  *
1084  * @param[in]  ...  Arguments for the format specification.
1085  *
1086  */
1087 
1088 /**
1089  * @def otLogNoteUtil
1090  *
1091  * This function generates a log with level note for the Util region.
1092  *
1093  * @param[in]  ...  Arguments for the format specification.
1094  *
1095  */
1096 
1097 /**
1098  * @def otLogInfoUtil
1099  *
1100  * This function generates a log with level info for the Util region.
1101  *
1102  * @param[in]  ...  Arguments for the format specification.
1103  *
1104  */
1105 
1106 /**
1107  * @def otLogDebgUtil
1108  *
1109  * This function generates a log with level debug for the Util region.
1110  *
1111  * @param[in]  ...  Arguments for the format specification.
1112  *
1113  */
1114 #if OPENTHREAD_CONFIG_LOG_UTIL
1115 #define otLogCritUtil(...) otLogCrit(OT_LOG_REGION_UTIL, _OT_REGION_UTIL_PREFIX, __VA_ARGS__)
1116 #define otLogWarnUtil(...) otLogWarn(OT_LOG_REGION_UTIL, _OT_REGION_UTIL_PREFIX, __VA_ARGS__)
1117 #define otLogNoteUtil(...) otLogNote(OT_LOG_REGION_UTIL, _OT_REGION_UTIL_PREFIX, __VA_ARGS__)
1118 #define otLogInfoUtil(...) otLogInfo(OT_LOG_REGION_UTIL, _OT_REGION_UTIL_PREFIX, __VA_ARGS__)
1119 #define otLogDebgUtil(...) otLogDebg(OT_LOG_REGION_UTIL, _OT_REGION_UTIL_PREFIX, __VA_ARGS__)
1120 #else
1121 #define otLogCritUtil(...)
1122 #define otLogWarnUtil(...)
1123 #define otLogNoteUtil(...)
1124 #define otLogInfoUtil(...)
1125 #define otLogDebgUtil(...)
1126 #endif
1127 
1128 /**
1129  * @def otLogCritNetDiag
1130  *
1131  * This function generates a log with level critical for the NETDIAG region.
1132  *
1133  * @param[in]  ...  Arguments for the format specification.
1134  *
1135  */
1136 
1137 /**
1138  * @def otLogWarnNetDiag
1139  *
1140  * This function generates a log with level warning for the NETDIAG region.
1141  *
1142  * @param[in]  ...  Arguments for the format specification.
1143  *
1144  */
1145 
1146 /**
1147  * @def otLogNoteNetDiag
1148  *
1149  * This function generates a log with level note for the NETDIAG region.
1150  *
1151  * @param[in]  ...  Arguments for the format specification.
1152  *
1153  */
1154 
1155 /**
1156  * @def otLogInfoNetDiag
1157  *
1158  * This function generates a log with level info for the NETDIAG region.
1159  *
1160  * @param[in]  ...  Arguments for the format specification.
1161  *
1162  */
1163 
1164 /**
1165  * @def otLogDebgNetDiag
1166  *
1167  * This function generates a log with level debug for the NETDIAG region.
1168  *
1169  * @param[in]  ...  Arguments for the format specification.
1170  *
1171  */
1172 #if OPENTHREAD_CONFIG_LOG_NETDIAG
1173 #define otLogCritNetDiag(...) otLogCrit(OT_LOG_REGION_NET_DIAG, _OT_REGION_NET_DIAG_PREFIX, __VA_ARGS__)
1174 #define otLogWarnNetDiag(...) otLogWarn(OT_LOG_REGION_NET_DIAG, _OT_REGION_NET_DIAG_PREFIX, __VA_ARGS__)
1175 #define otLogNoteNetDiag(...) otLogNote(OT_LOG_REGION_NET_DIAG, _OT_REGION_NET_DIAG_PREFIX, __VA_ARGS__)
1176 #define otLogInfoNetDiag(...) otLogInfo(OT_LOG_REGION_NET_DIAG, _OT_REGION_NET_DIAG_PREFIX, __VA_ARGS__)
1177 #define otLogDebgNetDiag(...) otLogDebg(OT_LOG_REGION_NET_DIAG, _OT_REGION_NET_DIAG_PREFIX, __VA_ARGS__)
1178 #else
1179 #define otLogCritNetDiag(...)
1180 #define otLogWarnNetDiag(...)
1181 #define otLogNoteNetDiag(...)
1182 #define otLogInfoNetDiag(...)
1183 #define otLogDebgNetDiag(...)
1184 #endif
1185 
1186 /**
1187  * @def otLogCert
1188  *
1189  * This function generates a log with level none for the certification test.
1190  *
1191  * @param[in]  ...  Arguments for the format specification.
1192  *
1193  *
1194  */
1195 #if !OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
1196 #define otLogCertMeshCoP(...)
1197 #elif OPENTHREAD_CONFIG_LOG_DEFINE_AS_MACRO_ONLY
1198 #define otLogCertMeshCoP(...) _otLogFormatter(OT_LOG_LEVEL_NONE, OT_LOG_REGION_MESH_COP, __VA_ARGS__)
1199 #else
1200 void otLogCertMeshCoP(const char *aFormat, ...);
1201 #endif
1202 
1203 /**
1204  * @def otLogCritCli
1205  *
1206  * This function generates a log with level critical for the CLI region.
1207  *
1208  * @param[in]  ...  Arguments for the format specification.
1209  *
1210  */
1211 
1212 /**
1213  * @def otLogWarnCli
1214  *
1215  * This function generates a log with level warning for the CLI region.
1216  *
1217  * @param[in]  ...  Arguments for the format specification.
1218  *
1219  */
1220 
1221 /**
1222  * @def otLogNoteCli
1223  *
1224  * This function generates a log with level note for the CLI region.
1225  *
1226  * @param[in]  ...  Arguments for the format specification.
1227  *
1228  */
1229 
1230 /**
1231  * @def otLogInfoCli
1232  *
1233  * This function generates a log with level info for the CLI region.
1234  *
1235  * @param[in]  ...  Arguments for the format specification.
1236  *
1237  */
1238 
1239 /**
1240  * @def otLogDebgCli
1241  *
1242  * This function generates a log with level debug for the CLI region.
1243  *
1244  * @param[in]  ...  Arguments for the format specification.
1245  *
1246  */
1247 #if OPENTHREAD_CONFIG_LOG_CLI
1248 
1249 #define otLogCritCli(...) otLogCrit(OT_LOG_REGION_CLI, _OT_REGION_CLI_PREFIX, __VA_ARGS__)
1250 #define otLogWarnCli(...) otLogWarn(OT_LOG_REGION_CLI, _OT_REGION_CLI_PREFIX, __VA_ARGS__)
1251 #define otLogNoteCli(...) otLogNote(OT_LOG_REGION_CLI, _OT_REGION_CLI_PREFIX, __VA_ARGS__)
1252 #define otLogInfoCli(...) otLogInfo(OT_LOG_REGION_CLI, _OT_REGION_CLI_PREFIX, __VA_ARGS__)
1253 #define otLogDebgCli(...) otLogDebg(OT_LOG_REGION_CLI, _OT_REGION_CLI_PREFIX, __VA_ARGS__)
1254 #else
1255 #define otLogCritCli(...)
1256 #define otLogWarnCli(...)
1257 #define otLogNoteCli(...)
1258 #define otLogInfoCli(...)
1259 #define otLogDebgCli(...)
1260 #endif
1261 
1262 /**
1263  * @def otLogCritCoap
1264  *
1265  * This function generates a log with level critical for the CoAP region.
1266  *
1267  * @param[in]  ...  Arguments for the format specification.
1268  *
1269  */
1270 
1271 /**
1272  * @def otLogWarnCoap
1273  *
1274  * This function generates a log with level warning for the CoAP region.
1275  *
1276  * @param[in]  ...  Arguments for the format specification.
1277  *
1278  */
1279 
1280 /**
1281  * @def otLogNoteCoap
1282  *
1283  * This function generates a log with level note for the CoAP region.
1284  *
1285  * @param[in]  ...  Arguments for the format specification.
1286  *
1287  */
1288 
1289 /**
1290  * @def otLogInfoCoap
1291  *
1292  * This function generates a log with level info for the CoAP region.
1293  *
1294  * @param[in]  ...  Arguments for the format specification.
1295  *
1296  */
1297 
1298 /**
1299  * @def otLogDebgCoap
1300  *
1301  * This function generates a log with level debug for the CoAP region.
1302  *
1303  * @param[in]  ...  Arguments for the format specification.
1304  *
1305  */
1306 #if OPENTHREAD_CONFIG_LOG_COAP
1307 #define otLogCritCoap(...) otLogCrit(OT_LOG_REGION_COAP, _OT_REGION_COAP_PREFIX, __VA_ARGS__)
1308 #define otLogWarnCoap(...) otLogWarn(OT_LOG_REGION_COAP, _OT_REGION_COAP_PREFIX, __VA_ARGS__)
1309 #define otLogNoteCoap(...) otLogNote(OT_LOG_REGION_COAP, _OT_REGION_COAP_PREFIX, __VA_ARGS__)
1310 #define otLogInfoCoap(...) otLogInfo(OT_LOG_REGION_COAP, _OT_REGION_COAP_PREFIX, __VA_ARGS__)
1311 #define otLogDebgCoap(...) otLogDebg(OT_LOG_REGION_COAP, _OT_REGION_COAP_PREFIX, __VA_ARGS__)
1312 #else
1313 #define otLogCritCoap(...)
1314 #define otLogWarnCoap(...)
1315 #define otLogNoteCoap(...)
1316 #define otLogInfoCoap(...)
1317 #define otLogDebgCoap(...)
1318 #endif
1319 
1320 /**
1321  * @def otLogCritDua
1322  *
1323  * This function generates a log with level critical for the Domain Unicast Address region.
1324  *
1325  * @param[in]  ...  Arguments for the format specification.
1326  *
1327  */
1328 
1329 /**
1330  * @def otLogWarnDua
1331  *
1332  * This function generates a log with level warning for the Domain Unicast Address region.
1333  *
1334  * @param[in]  ...  Arguments for the format specification.
1335  *
1336  */
1337 
1338 /**
1339  * @def otLogNoteDua
1340  *
1341  * This function generates a log with level note for the Domain Unicast Address region.
1342  *
1343  * @param[in]  ...  Arguments for the format specification.
1344  *
1345  */
1346 
1347 /**
1348  * @def otLogInfoDua
1349  *
1350  * This function generates a log with level info for the Domain Unicast Address region.
1351  *
1352  * @param[in]  ...  Arguments for the format specification.
1353  *
1354  */
1355 
1356 /**
1357  * @def otLogDebgDua
1358  *
1359  * This function generates a log with level debug for the Domain Unicast Address region.
1360  *
1361  * @param[in]  ...  Arguments for the format specification.
1362  *
1363  */
1364 #if OPENTHREAD_CONFIG_LOG_DUA
1365 #define otLogCritDua(...) otLogCrit(OT_LOG_REGION_DUA, _OT_REGION_DUA_PREFIX, __VA_ARGS__)
1366 #define otLogWarnDua(...) otLogWarn(OT_LOG_REGION_DUA, _OT_REGION_DUA_PREFIX, __VA_ARGS__)
1367 #define otLogNoteDua(...) otLogNote(OT_LOG_REGION_DUA, _OT_REGION_DUA_PREFIX, __VA_ARGS__)
1368 #define otLogInfoDua(...) otLogInfo(OT_LOG_REGION_DUA, _OT_REGION_DUA_PREFIX, __VA_ARGS__)
1369 #define otLogDebgDua(...) otLogDebg(OT_LOG_REGION_DUA, _OT_REGION_DUA_PREFIX, __VA_ARGS__)
1370 #else
1371 #define otLogCritDua(...)
1372 #define otLogWarnDua(...)
1373 #define otLogNoteDua(...)
1374 #define otLogInfoDua(...)
1375 #define otLogDebgDua(...)
1376 #endif
1377 
1378 /**
1379  * @def otLogCritSrp
1380  *
1381  * This function generates a log with level critical for the Service Registration Protocol (SRP) region.
1382  *
1383  * @param[in]  ...  Arguments for the format specification.
1384  *
1385  */
1386 
1387 /**
1388  * @def otLogWarnSrp
1389  *
1390  * This function generates a log with level warning for the Service Registration Protocol (SRP) region.
1391  *
1392  * @param[in]  ...  Arguments for the format specification.
1393  *
1394  */
1395 
1396 /**
1397  * @def otLogNoteSrp
1398  *
1399  * This function generates a log with level note for the Service Registration Protocol (SRP) region.
1400  *
1401  * @param[in]  ...  Arguments for the format specification.
1402  *
1403  */
1404 
1405 /**
1406  * @def otLogInfoSrp
1407  *
1408  * This function generates a log with level info for the Service Registration Protocol (SRP) region.
1409  *
1410  * @param[in]  ...  Arguments for the format specification.
1411  *
1412  */
1413 
1414 /**
1415  * @def otLogDebgSrp
1416  *
1417  * This function generates a log with level debug for the Service Registration Protocol (SRP) region.
1418  *
1419  * @param[in]  ...  Arguments for the format specification.
1420  *
1421  */
1422 #if OPENTHREAD_CONFIG_LOG_SRP
1423 #define otLogCritSrp(...) otLogCrit(OT_LOG_REGION_SRP, _OT_REGION_SRP_PREFIX, __VA_ARGS__)
1424 #define otLogWarnSrp(...) otLogWarn(OT_LOG_REGION_SRP, _OT_REGION_SRP_PREFIX, __VA_ARGS__)
1425 #define otLogNoteSrp(...) otLogNote(OT_LOG_REGION_SRP, _OT_REGION_SRP_PREFIX, __VA_ARGS__)
1426 #define otLogInfoSrp(...) otLogInfo(OT_LOG_REGION_SRP, _OT_REGION_SRP_PREFIX, __VA_ARGS__)
1427 #define otLogDebgSrp(...) otLogDebg(OT_LOG_REGION_SRP, _OT_REGION_SRP_PREFIX, __VA_ARGS__)
1428 #else
1429 #define otLogCritSrp(...)
1430 #define otLogWarnSrp(...)
1431 #define otLogNoteSrp(...)
1432 #define otLogInfoSrp(...)
1433 #define otLogDebgSrp(...)
1434 #endif
1435 
1436 /**
1437  * @def otLogCritDns
1438  *
1439  * This function generates a log with level critical for the DNS region.
1440  *
1441  * @param[in]  ...  Arguments for the format specification.
1442  *
1443  */
1444 
1445 /**
1446  * @def otLogWarnDns
1447  *
1448  * This function generates a log with level warning for the DNS region.
1449  *
1450  * @param[in]  ...  Arguments for the format specification.
1451  *
1452  */
1453 
1454 /**
1455  * @def otLogNoteDns
1456  *
1457  * This function generates a log with level note for the DNS region.
1458  *
1459  * @param[in]  ...  Arguments for the format specification.
1460  *
1461  */
1462 
1463 /**
1464  * @def otLogInfoDns
1465  *
1466  * This function generates a log with level info for the DNS region.
1467  *
1468  * @param[in]  ...  Arguments for the format specification.
1469  *
1470  */
1471 
1472 /**
1473  * @def otLogDebgDns
1474  *
1475  * This function generates a log with level debug for the DNS region.
1476  *
1477  * @param[in]  ...  Arguments for the format specification.
1478  *
1479  */
1480 #if OPENTHREAD_CONFIG_LOG_DNS
1481 #define otLogCritDns(...) otLogCrit(OT_LOG_REGION_DNS, _OT_REGION_DNS_PREFIX, __VA_ARGS__)
1482 #define otLogWarnDns(...) otLogWarn(OT_LOG_REGION_DNS, _OT_REGION_DNS_PREFIX, __VA_ARGS__)
1483 #define otLogNoteDns(...) otLogNote(OT_LOG_REGION_DNS, _OT_REGION_DNS_PREFIX, __VA_ARGS__)
1484 #define otLogInfoDns(...) otLogInfo(OT_LOG_REGION_DNS, _OT_REGION_DNS_PREFIX, __VA_ARGS__)
1485 #define otLogDebgDns(...) otLogDebg(OT_LOG_REGION_DNS, _OT_REGION_DNS_PREFIX, __VA_ARGS__)
1486 #else
1487 #define otLogCritDns(...)
1488 #define otLogWarnDns(...)
1489 #define otLogNoteDns(...)
1490 #define otLogInfoDns(...)
1491 #define otLogDebgDns(...)
1492 #endif
1493 
1494 /**
1495  * @def otLogCritPlat
1496  *
1497  * This function generates a log with level critical for the Platform region.
1498  *
1499  * @param[in]  ...       Arguments for the format specification.
1500  *
1501  */
1502 
1503 /**
1504  * @def otLogWarnPlat
1505  *
1506  * This function generates a log with level warning for the Platform region.
1507  *
1508  * @param[in]  ...       Arguments for the format specification.
1509  *
1510  */
1511 
1512 /**
1513  * @def otLogNotePlat
1514  *
1515  * This function generates a log with level note for the Platform region.
1516  *
1517  * @param[in]  ...       Arguments for the format specification.
1518  *
1519  */
1520 
1521 /**
1522  * @def otLogInfoPlat
1523  *
1524  * This function generates a log with level info for the Platform region.
1525  *
1526  * @param[in]  ...       Arguments for the format specification.
1527  *
1528  */
1529 
1530 /**
1531  * @def otLogDebgPlat
1532  *
1533  * This function generates a log with level debug for the Platform region.
1534  *
1535  * @param[in]  ...       Arguments for the format specification.
1536  *
1537  */
1538 #if OPENTHREAD_CONFIG_LOG_PLATFORM
1539 #define otLogCritPlat(...) otLogCrit(OT_LOG_REGION_PLATFORM, _OT_REGION_PLATFORM_PREFIX, __VA_ARGS__)
1540 #define otLogWarnPlat(...) otLogWarn(OT_LOG_REGION_PLATFORM, _OT_REGION_PLATFORM_PREFIX, __VA_ARGS__)
1541 #define otLogNotePlat(...) otLogNote(OT_LOG_REGION_PLATFORM, _OT_REGION_PLATFORM_PREFIX, __VA_ARGS__)
1542 #define otLogInfoPlat(...) otLogInfo(OT_LOG_REGION_PLATFORM, _OT_REGION_PLATFORM_PREFIX, __VA_ARGS__)
1543 #define otLogDebgPlat(...) otLogDebg(OT_LOG_REGION_PLATFORM, _OT_REGION_PLATFORM_PREFIX, __VA_ARGS__)
1544 #else
1545 #define otLogCritPlat(...)
1546 #define otLogWarnPlat(...)
1547 #define otLogNotePlat(...)
1548 #define otLogInfoPlat(...)
1549 #define otLogDebgPlat(...)
1550 #endif
1551 
1552 /**
1553  * @def otLogOtns
1554  *
1555  * This function generates a log with level none for the Core region,
1556  * and is specifically for OTNS visualization use.
1557  *
1558  * @param[in]  ...       Arguments for the format specification.
1559  *
1560  */
1561 #if OPENTHREAD_CONFIG_OTNS_ENABLE
1562 #if OPENTHREAD_CONFIG_LOG_DEFINE_AS_MACRO_ONLY
1563 #define otLogOtns(...) _otLogFormatter(OT_LOG_LEVEL_NONE, OT_LOG_REGION_CORE, _OT_LEVEL_NONE_PREFIX __VA_ARGS__)
1564 #else
1565 void otLogOtns(const char *aFormat, ...);
1566 #endif
1567 #endif
1568 
1569 /**
1570  * @def otDumpCrit
1571  *
1572  * This function generates a memory dump with log level critical.
1573  *
1574  * @param[in]  aRegion      The log region.
1575  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1576  * @param[in]  aBuf         A pointer to the buffer.
1577  * @param[in]  aLength      Number of bytes to print.
1578  *
1579  */
1580 #if OPENTHREAD_CONFIG_LOG_LEVEL >= OT_LOG_LEVEL_CRIT
1581 #define otDumpCrit(aRegion, aId, aBuf, aLength) otDump(OT_LOG_LEVEL_CRIT, aRegion, aId, aBuf, aLength)
1582 #else
1583 #define otDumpCrit(aRegion, aId, aBuf, aLength)
1584 #endif
1585 
1586 /**
1587  * @def otDumpWarn
1588  *
1589  * This function generates a memory dump with log level warning.
1590  *
1591  * @param[in]  aRegion      The log region.
1592  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1593  * @param[in]  aBuf         A pointer to the buffer.
1594  * @param[in]  aLength      Number of bytes to print.
1595  *
1596  */
1597 #if OPENTHREAD_CONFIG_LOG_LEVEL >= OT_LOG_LEVEL_WARN
1598 #define otDumpWarn(aRegion, aId, aBuf, aLength) otDump(OT_LOG_LEVEL_WARN, aRegion, aId, aBuf, aLength)
1599 #else
1600 #define otDumpWarn(aRegion, aId, aBuf, aLength)
1601 #endif
1602 
1603 /**
1604  * @def otDumpNote
1605  *
1606  * This function generates a memory dump with log level note.
1607  *
1608  * @param[in]  aRegion      The log region.
1609  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1610  * @param[in]  aBuf         A pointer to the buffer.
1611  * @param[in]  aLength      Number of bytes to print.
1612  *
1613  */
1614 #if OPENTHREAD_CONFIG_LOG_LEVEL >= OT_LOG_LEVEL_NOTE
1615 #define otDumpNote(aRegion, aId, aBuf, aLength) otDump(OT_LOG_LEVEL_NOTE, aRegion, aId, aBuf, aLength)
1616 #else
1617 #define otDumpNote(aRegion, aId, aBuf, aLength)
1618 #endif
1619 
1620 /**
1621  * @def otDumpInfo
1622  *
1623  * This function generates a memory dump with log level info.
1624  *
1625  * @param[in]  aRegion      The log region.
1626  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1627  * @param[in]  aBuf         A pointer to the buffer.
1628  * @param[in]  aLength      Number of bytes to print.
1629  *
1630  */
1631 #if OPENTHREAD_CONFIG_LOG_LEVEL >= OT_LOG_LEVEL_INFO
1632 #define otDumpInfo(aRegion, aId, aBuf, aLength) otDump(OT_LOG_LEVEL_INFO, aRegion, aId, aBuf, aLength)
1633 #else
1634 #define otDumpInfo(aRegion, aId, aBuf, aLength)
1635 #endif
1636 
1637 /**
1638  * @def otDumpDebg
1639  *
1640  * This function generates a memory dump with log level debug.
1641  *
1642  * @param[in]  aRegion      The log region.
1643  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1644  * @param[in]  aBuf         A pointer to the buffer.
1645  * @param[in]  aLength      Number of bytes to print.
1646  *
1647  */
1648 #if OPENTHREAD_CONFIG_LOG_LEVEL >= OT_LOG_LEVEL_DEBG
1649 #define otDumpDebg(aRegion, aId, aBuf, aLength) otDump(OT_LOG_LEVEL_DEBG, aRegion, aId, aBuf, aLength)
1650 #else
1651 #define otDumpDebg(aRegion, aId, aBuf, aLength)
1652 #endif
1653 
1654 /**
1655  * @def otDumpCritNetData
1656  *
1657  * This function generates a memory dump with log level debug and region Network Data.
1658  *
1659  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1660  * @param[in]  aBuf         A pointer to the buffer.
1661  * @param[in]  aLength      Number of bytes to print.
1662  *
1663  */
1664 
1665 /**
1666  * @def otDumpWarnNetData
1667  *
1668  * This function generates a memory dump with log level warning and region Network Data.
1669  *
1670  * @param[in]  aBuf         A pointer to the buffer.
1671  * @param[in]  aLength      Number of bytes to print.
1672  *
1673  */
1674 
1675 /**
1676  * @def otDumpNoteNetData
1677  *
1678  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1679  * @param[in]  aBuf         A pointer to the buffer.
1680  * @param[in]  aLength      Number of bytes to print.
1681  *
1682  */
1683 
1684 /**
1685  * @def otDumpInfoNetData
1686  *
1687  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1688  * @param[in]  aBuf         A pointer to the buffer.
1689  * @param[in]  aLength      Number of bytes to print.
1690  *
1691  */
1692 
1693 /**
1694  * @def otDumpDebgNetData
1695  *
1696  * This function generates a memory dump with log level debug and region Network Data.
1697  *
1698  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1699  * @param[in]  aBuf         A pointer to the buffer.
1700  * @param[in]  aLength      Number of bytes to print.
1701  *
1702  */
1703 #if OPENTHREAD_CONFIG_LOG_NETDATA
1704 #define otDumpCritNetData(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_NET_DATA, aId, aBuf, aLength)
1705 #define otDumpWarnNetData(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_NET_DATA, aId, aBuf, aLength)
1706 #define otDumpNoteNetData(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_NET_DATA, aId, aBuf, aLength)
1707 #define otDumpInfoNetData(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_NET_DATA, aId, aBuf, aLength)
1708 #define otDumpDebgNetData(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_NET_DATA, aId, aBuf, aLength)
1709 #else
1710 #define otDumpCritNetData(aId, aBuf, aLength)
1711 #define otDumpWarnNetData(aId, aBuf, aLength)
1712 #define otDumpNoteNetData(aId, aBuf, aLength)
1713 #define otDumpInfoNetData(aId, aBuf, aLength)
1714 #define otDumpDebgNetData(aId, aBuf, aLength)
1715 #endif
1716 
1717 /**
1718  * @def otDumpCritMle
1719  *
1720  * This function generates a memory dump with log level debug and region MLE.
1721  *
1722  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1723  * @param[in]  aBuf         A pointer to the buffer.
1724  * @param[in]  aLength      Number of bytes to print.
1725  *
1726  */
1727 
1728 /**
1729  * @def otDumpWarnMle
1730  *
1731  * This function generates a memory dump with log level warning and region MLE.
1732  *
1733  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1734  * @param[in]  aBuf         A pointer to the buffer.
1735  * @param[in]  aLength      Number of bytes to print.
1736  *
1737  */
1738 
1739 /**
1740  * @def otDumpNoteMle
1741  *
1742  * This function generates a memory dump with log level note and region MLE.
1743  *
1744  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1745  * @param[in]  aBuf         A pointer to the buffer.
1746  * @param[in]  aLength      Number of bytes to print.
1747  *
1748  */
1749 
1750 /**
1751  * @def otDumpInfoMle
1752  *
1753  * This function generates a memory dump with log level info and region MLE.
1754  *
1755  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1756  * @param[in]  aBuf         A pointer to the buffer.
1757  * @param[in]  aLength      Number of bytes to print.
1758  *
1759  */
1760 
1761 /**
1762  * @def otDumpDebgMle
1763  *
1764  * This function generates a memory dump with log level debug and region MLE.
1765  *
1766  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1767  * @param[in]  aBuf         A pointer to the buffer.
1768  * @param[in]  aLength      Number of bytes to print.
1769  *
1770  */
1771 #if OPENTHREAD_CONFIG_LOG_MLE
1772 #define otDumpCritMle(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_MLE, aId, aBuf, aLength)
1773 #define otDumpWarnMle(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_MLE, aId, aBuf, aLength)
1774 #define otDumpNoteMle(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_MLE, aId, aBuf, aLength)
1775 #define otDumpInfoMle(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_MLE, aId, aBuf, aLength)
1776 #define otDumpDebgMle(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_MLE, aId, aBuf, aLength)
1777 #else
1778 #define otDumpCritMle(aId, aBuf, aLength)
1779 #define otDumpWarnMle(aId, aBuf, aLength)
1780 #define otDumpNoteMle(aId, aBuf, aLength)
1781 #define otDumpInfoMle(aId, aBuf, aLength)
1782 #define otDumpDebgMle(aId, aBuf, aLength)
1783 #endif
1784 
1785 /**
1786  * @def otDumpCritArp
1787  *
1788  * This function generates a memory dump with log level debug and region EID-to-RLOC mapping.
1789  *
1790  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1791  * @param[in]  aBuf         A pointer to the buffer.
1792  * @param[in]  aLength      Number of bytes to print.
1793  *
1794  */
1795 
1796 /**
1797  * @def otDumpWarnArp
1798  *
1799  * This function generates a memory dump with log level warning and region EID-to-RLOC mapping.
1800  *
1801  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1802  * @param[in]  aBuf         A pointer to the buffer.
1803  * @param[in]  aLength      Number of bytes to print.
1804  *
1805  */
1806 
1807 /**
1808  * @def otDumpNoteArp
1809  *
1810  * This function generates a memory dump with log level note and region EID-to-RLOC mapping.
1811  *
1812  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1813  * @param[in]  aBuf         A pointer to the buffer.
1814  * @param[in]  aLength      Number of bytes to print.
1815  *
1816  */
1817 
1818 /**
1819  * @def otDumpInfoArp
1820  *
1821  * This function generates a memory dump with log level info and region EID-to-RLOC mapping.
1822  *
1823  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1824  * @param[in]  aBuf         A pointer to the buffer.
1825  * @param[in]  aLength      Number of bytes to print.
1826  *
1827  */
1828 
1829 /**
1830  * @def otDumpDebgArp
1831  *
1832  * This function generates a memory dump with log level debug and region EID-to-RLOC mapping.
1833  *
1834  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1835  * @param[in]  aBuf         A pointer to the buffer.
1836  * @param[in]  aLength      Number of bytes to print.
1837  *
1838  */
1839 #if OPENTHREAD_CONFIG_LOG_ARP
1840 #define otDumpCritArp(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_ARP, aId, aBuf, aLength)
1841 #define otDumpWarnArp(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_ARP, aId, aBuf, aLength)
1842 #define otDumpNoteArp(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_ARP, aId, aBuf, aLength)
1843 #define otDumpInfoArp(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_ARP, aId, aBuf, aLength)
1844 #define otDumpDebgArp(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_ARP, aId, aBuf, aLength)
1845 #else
1846 #define otDumpCritArp(aId, aBuf, aLength)
1847 #define otDumpWarnArp(aId, aBuf, aLength)
1848 #define otDumpNoteArp(aId, aBuf, aLength)
1849 #define otDumpInfoArp(aId, aBuf, aLength)
1850 #define otDumpDebgArp(aId, aBuf, aLength)
1851 #endif
1852 
1853 /**
1854  * @def otDumpCritBbr
1855  *
1856  * This function generates a memory dump with log level critical and region Backbone Router (BBR).
1857  *
1858  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1859  * @param[in]  aBuf         A pointer to the buffer.
1860  * @param[in]  aLength      Number of bytes to print.
1861  *
1862  */
1863 
1864 /**
1865  * @def otDumpWarnBbr
1866  *
1867  * This function generates a memory dump with log level warning and region Backbone Router (BBR).
1868  *
1869  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1870  * @param[in]  aBuf         A pointer to the buffer.
1871  * @param[in]  aLength      Number of bytes to print.
1872  *
1873  */
1874 
1875 /**
1876  * @def otDumpNoteBbr
1877  *
1878  * This function generates a memory dump with log level note and region Backbone Router (BBR).
1879  *
1880  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1881  * @param[in]  aBuf         A pointer to the buffer.
1882  * @param[in]  aLength      Number of bytes to print.
1883  *
1884  */
1885 
1886 /**
1887  * @def otDumpInfoBbr
1888  *
1889  * This function generates a memory dump with log level info and region Backbone Router (BBR).
1890  *
1891  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1892  * @param[in]  aBuf         A pointer to the buffer.
1893  * @param[in]  aLength      Number of bytes to print.
1894  *
1895  */
1896 
1897 /**
1898  * @def otDumpDebgBbr
1899  *
1900  * This function generates a memory dump with log level debug and region Backbone Router (BBR).
1901  *
1902  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1903  * @param[in]  aBuf         A pointer to the buffer.
1904  * @param[in]  aLength      Number of bytes to print.
1905  *
1906  */
1907 #if OPENTHREAD_CONFIG_LOG_BBR
1908 #define otDumpCritBbr(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_BBR, aId, aBuf, aLength)
1909 #define otDumpWarnBbr(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_BBR, aId, aBuf, aLength)
1910 #define otDumpNoteBbr(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_BBR, aId, aBuf, aLength)
1911 #define otDumpInfoBbr(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_BBR, aId, aBuf, aLength)
1912 #define otDumpDebgBbr(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_BBR, aId, aBuf, aLength)
1913 #else
1914 #define otDumpCritBbr(aId, aBuf, aLength)
1915 #define otDumpWarnBbr(aId, aBuf, aLength)
1916 #define otDumpNoteBbr(aId, aBuf, aLength)
1917 #define otDumpInfoBbr(aId, aBuf, aLength)
1918 #define otDumpDebgBbr(aId, aBuf, aLength)
1919 #endif
1920 
1921 /**
1922  * @def otDumpCritMlr
1923  *
1924  * This function generates a memory dump with log level critical and region Multicast Listener Registration (MLR).
1925  *
1926  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1927  * @param[in]  aBuf         A pointer to the buffer.
1928  * @param[in]  aLength      Number of bytes to print.
1929  *
1930  */
1931 
1932 /**
1933  * @def otDumpWarnMlr
1934  *
1935  * This function generates a memory dump with log level warning and region Multicast Listener Registration (MLR).
1936  *
1937  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1938  * @param[in]  aBuf         A pointer to the buffer.
1939  * @param[in]  aLength      Number of bytes to print.
1940  *
1941  */
1942 
1943 /**
1944  * @def otDumpNoteMlr
1945  *
1946  * This function generates a memory dump with log level note and region Multicast Listener Registration (MLR).
1947  *
1948  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1949  * @param[in]  aBuf         A pointer to the buffer.
1950  * @param[in]  aLength      Number of bytes to print.
1951  *
1952  */
1953 
1954 /**
1955  * @def otDumpInfoMlr
1956  *
1957  * This function generates a memory dump with log level info and region Multicast Listener Registration (MLR).
1958  *
1959  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1960  * @param[in]  aBuf         A pointer to the buffer.
1961  * @param[in]  aLength      Number of bytes to print.
1962  *
1963  */
1964 
1965 /**
1966  * @def otDumpDebgMlr
1967  *
1968  * This function generates a memory dump with log level debug and region Multicast Listener Registration (MLR).
1969  *
1970  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1971  * @param[in]  aBuf         A pointer to the buffer.
1972  * @param[in]  aLength      Number of bytes to print.
1973  *
1974  */
1975 #if OPENTHREAD_CONFIG_LOG_MLR
1976 #define otDumpCritMlr(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_MLR, aId, aBuf, aLength)
1977 #define otDumpWarnMlr(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_MLR, aId, aBuf, aLength)
1978 #define otDumpNoteMlr(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_MLR, aId, aBuf, aLength)
1979 #define otDumpInfoMlr(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_MLR, aId, aBuf, aLength)
1980 #define otDumpDebgMlr(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_MLR, aId, aBuf, aLength)
1981 #else
1982 #define otDumpCritMlr(aId, aBuf, aLength)
1983 #define otDumpWarnMlr(aId, aBuf, aLength)
1984 #define otDumpNoteMlr(aId, aBuf, aLength)
1985 #define otDumpInfoMlr(aId, aBuf, aLength)
1986 #define otDumpDebgMlr(aId, aBuf, aLength)
1987 #endif
1988 
1989 /**
1990  * @def otDumpCritIcmp
1991  *
1992  * This function generates a memory dump with log level debug and region ICMPv6.
1993  *
1994  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
1995  * @param[in]  aBuf         A pointer to the buffer.
1996  * @param[in]  aLength      Number of bytes to print.
1997  *
1998  */
1999 
2000 /**
2001  * @def otDumpWarnIcmp
2002  *
2003  * This function generates a memory dump with log level warning and region ICMPv6.
2004  *
2005  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2006  * @param[in]  aBuf         A pointer to the buffer.
2007  * @param[in]  aLength      Number of bytes to print.
2008  *
2009  */
2010 
2011 /**
2012  * @def otDumpNoteIcmp
2013  *
2014  * This function generates a memory dump with log level note and region ICMPv6.
2015  *
2016  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2017  * @param[in]  aBuf         A pointer to the buffer.
2018  * @param[in]  aLength      Number of bytes to print.
2019  *
2020  */
2021 
2022 /**
2023  * @def otDumpInfoIcmp
2024  *
2025  * This function generates a memory dump with log level info and region ICMPv6.
2026  *
2027  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2028  * @param[in]  aBuf         A pointer to the buffer.
2029  * @param[in]  aLength      Number of bytes to print.
2030  *
2031  */
2032 
2033 /**
2034  * @def otDumpDebgIcmp
2035  *
2036  * This function generates a memory dump with log level debug and region ICMPv6.
2037  *
2038  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2039  * @param[in]  aBuf         A pointer to the buffer.
2040  * @param[in]  aLength      Number of bytes to print.
2041  *
2042  */
2043 #if OPENTHREAD_CONFIG_LOG_ICMP
2044 #define otDumpCritIcmp(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_ICMP, aId, aBuf, aLength)
2045 #define otDumpWarnIcmp(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_ICMP, aId, aBuf, aLength)
2046 #define otDumpNoteIcmp(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_ICMP, aId, aBuf, aLength)
2047 #define otDumpInfoIcmp(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_ICMP, aId, aBuf, aLength)
2048 #define otDumpDebgIcmp(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_ICMP, aId, aBuf, aLength)
2049 #else
2050 #define otDumpCritIcmp(aId, aBuf, aLength)
2051 #define otDumpWarnIcmp(aId, aBuf, aLength)
2052 #define otDumpNoteIcmp(aId, aBuf, aLength)
2053 #define otDumpInfoIcmp(aId, aBuf, aLength)
2054 #define otDumpDebgIcmp(aId, aBuf, aLength)
2055 #endif
2056 
2057 /**
2058  * @def otDumpCritIp6
2059  *
2060  * This function generates a memory dump with log level debug and region IPv6.
2061  *
2062  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2063  * @param[in]  aBuf         A pointer to the buffer.
2064  * @param[in]  aLength      Number of bytes to print.
2065  *
2066  */
2067 
2068 /**
2069  * @def otDumpWarnIp6
2070  *
2071  * This function generates a memory dump with log level warning and region IPv6.
2072  *
2073  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2074  * @param[in]  aBuf         A pointer to the buffer.
2075  * @param[in]  aLength      Number of bytes to print.
2076  *
2077  */
2078 
2079 /**
2080  * @def otDumpNoteIp6
2081  *
2082  * This function generates a memory dump with log level note and region IPv6.
2083  *
2084  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2085  * @param[in]  aBuf         A pointer to the buffer.
2086  * @param[in]  aLength      Number of bytes to print.
2087  *
2088  */
2089 
2090 /**
2091  * @def otDumpInfoIp6
2092  *
2093  * This function generates a memory dump with log level info and region IPv6.
2094  *
2095  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2096  * @param[in]  aBuf         A pointer to the buffer.
2097  * @param[in]  aLength      Number of bytes to print.
2098  *
2099  */
2100 
2101 /**
2102  * @def otDumpDebgIp6
2103  *
2104  * This function generates a memory dump with log level debug and region IPv6.
2105  *
2106  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2107  * @param[in]  aBuf         A pointer to the buffer.
2108  * @param[in]  aLength      Number of bytes to print.
2109  *
2110  */
2111 #if OPENTHREAD_CONFIG_LOG_IP6
2112 #define otDumpCritIp6(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_IP6, aId, aBuf, aLength)
2113 #define otDumpWarnIp6(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_IP6, aId, aBuf, aLength)
2114 #define otDumpNoteIp6(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_IP6, aId, aBuf, aLength)
2115 #define otDumpInfoIp6(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_IP6, aId, aBuf, aLength)
2116 #define otDumpDebgIp6(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_IP6, aId, aBuf, aLength)
2117 #else
2118 #define otDumpCritIp6(aId, aBuf, aLength)
2119 #define otDumpWarnIp6(aId, aBuf, aLength)
2120 #define otDumpNoteIp6(aId, aBuf, aLength)
2121 #define otDumpInfoIp6(aId, aBuf, aLength)
2122 #define otDumpDebgIp6(aId, aBuf, aLength)
2123 #endif
2124 
2125 /**
2126  * @def otDumpCritTcp
2127  *
2128  * This function generates a memory dump with log level debug and region TCP.
2129  *
2130  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2131  * @param[in]  aBuf         A pointer to the buffer.
2132  * @param[in]  aLength      Number of bytes to print.
2133  *
2134  */
2135 
2136 /**
2137  * @def otDumpWartTcp
2138  *
2139  * This function generates a memory dump with log level warning and region TCP.
2140  *
2141  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2142  * @param[in]  aBuf         A pointer to the buffer.
2143  * @param[in]  aLength      Number of bytes to print.
2144  *
2145  */
2146 
2147 /**
2148  * @def otDumpNottTcp
2149  *
2150  * This function generates a memory dump with log level note and region TCP.
2151  *
2152  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2153  * @param[in]  aBuf         A pointer to the buffer.
2154  * @param[in]  aLength      Number of bytes to print.
2155  *
2156  */
2157 
2158 /**
2159  * @def otDumpInftTcp
2160  *
2161  * This function generates a memory dump with log level info and region TCP.
2162  *
2163  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2164  * @param[in]  aBuf         A pointer to the buffer.
2165  * @param[in]  aLength      Number of bytes to print.
2166  *
2167  */
2168 
2169 /**
2170  * @def otDumpDebtTcp
2171  *
2172  * This function generates a memory dump with log level debug and region TCP.
2173  *
2174  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2175  * @param[in]  aBuf         A pointer to the buffer.
2176  * @param[in]  aLength      Number of bytes to print.
2177  *
2178  */
2179 #if OPENTHREAD_CONFIG_LOG_TCP
2180 #define otDumpCritTcp(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_TCP, aId, aBuf, aLength)
2181 #define otDumpWarnTcp(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_TCP, aId, aBuf, aLength)
2182 #define otDumpNoteTcp(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_TCP, aId, aBuf, aLength)
2183 #define otDumpInfoTcp(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_TCP, aId, aBuf, aLength)
2184 #define otDumpDebgTcp(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_TCP, aId, aBuf, aLength)
2185 #else
2186 #define otDumpCritTcp(aId, aBuf, aLength)
2187 #define otDumpWarnTcp(aId, aBuf, aLength)
2188 #define otDumpNoteTcp(aId, aBuf, aLength)
2189 #define otDumpInfoTcp(aId, aBuf, aLength)
2190 #define otDumpDebgTcp(aId, aBuf, aLength)
2191 #endif
2192 
2193 /**
2194  * @def otDumpCritMac
2195  *
2196  * This function generates a memory dump with log level debug and region MAC.
2197  *
2198  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2199  * @param[in]  aBuf         A pointer to the buffer.
2200  * @param[in]  aLength      Number of bytes to print.
2201  *
2202  */
2203 
2204 /**
2205  * @def otDumpWarnMac
2206  *
2207  * This function generates a memory dump with log level warning and region MAC.
2208  *
2209  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2210  * @param[in]  aBuf         A pointer to the buffer.
2211  * @param[in]  aLength      Number of bytes to print.
2212  *
2213  */
2214 
2215 /**
2216  * @def otDumpNoteMac
2217  *
2218  * This function generates a memory dump with log level note and region MAC.
2219  *
2220  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2221  * @param[in]  aBuf         A pointer to the buffer.
2222  * @param[in]  aLength      Number of bytes to print.
2223  *
2224  */
2225 
2226 /**
2227  * @def otDumpInfoMac
2228  *
2229  * This function generates a memory dump with log level info and region MAC.
2230  *
2231  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2232  * @param[in]  aBuf         A pointer to the buffer.
2233  * @param[in]  aLength      Number of bytes to print.
2234  *
2235  */
2236 
2237 /**
2238  * @def otDumpDebgMac
2239  *
2240  * This function generates a memory dump with log level debug and region MAC.
2241  *
2242  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2243  * @param[in]  aBuf         A pointer to the buffer.
2244  * @param[in]  aLength      Number of bytes to print.
2245  *
2246  */
2247 #if OPENTHREAD_CONFIG_LOG_MAC
2248 #define otDumpCritMac(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_MAC, aId, aBuf, aLength)
2249 #define otDumpWarnMac(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_MAC, aId, aBuf, aLength)
2250 #define otDumpNoteMac(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_MAC, aId, aBuf, aLength)
2251 #define otDumpInfoMac(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_MAC, aId, aBuf, aLength)
2252 #define otDumpDebgMac(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_MAC, aId, aBuf, aLength)
2253 #else
2254 #define otDumpCritMac(aId, aBuf, aLength)
2255 #define otDumpWarnMac(aId, aBuf, aLength)
2256 #define otDumpNoteMac(aId, aBuf, aLength)
2257 #define otDumpInfoMac(aId, aBuf, aLength)
2258 #define otDumpDebgMac(aId, aBuf, aLength)
2259 #endif
2260 
2261 /**
2262  * @def otDumpCritCore
2263  *
2264  * This function generates a memory dump with log level debug and region Core.
2265  *
2266  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2267  * @param[in]  aBuf         A pointer to the buffer.
2268  * @param[in]  aLength      Number of bytes to print.
2269  *
2270  */
2271 
2272 /**
2273  * @def otDumpWarnCore
2274  *
2275  * This function generates a memory dump with log level warning and region Core.
2276  *
2277  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2278  * @param[in]  aBuf         A pointer to the buffer.
2279  * @param[in]  aLength      Number of bytes to print.
2280  *
2281  */
2282 
2283 /**
2284  * @def otDumpNoteCore
2285  *
2286  * This function generates a memory dump with log level note and region Core.
2287  *
2288  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2289  * @param[in]  aBuf         A pointer to the buffer.
2290  * @param[in]  aLength      Number of bytes to print.
2291  *
2292  */
2293 
2294 /**
2295  * @def otDumpInfoCore
2296  *
2297  * This function generates a memory dump with log level info and region Core.
2298  *
2299  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2300  * @param[in]  aBuf         A pointer to the buffer.
2301  * @param[in]  aLength      Number of bytes to print.
2302  *
2303  */
2304 
2305 /**
2306  * @def otDumpDebgCore
2307  *
2308  * This function generates a memory dump with log level debug and region Core.
2309  *
2310  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2311  * @param[in]  aBuf         A pointer to the buffer.
2312  * @param[in]  aLength      Number of bytes to print.
2313  *
2314  */
2315 #if OPENTHREAD_CONFIG_LOG_CORE
2316 #define otDumpCritCore(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_CORE, aId, aBuf, aLength)
2317 #define otDumpWarnCore(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_CORE, aId, aBuf, aLength)
2318 #define otDumpNoteCore(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_CORE, aId, aBuf, aLength)
2319 #define otDumpInfoCore(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_CORE, aId, aBuf, aLength)
2320 #define otDumpDebgCore(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_CORE, aId, aBuf, aLength)
2321 #else
2322 #define otDumpCritCore(aId, aBuf, aLength)
2323 #define otDumpWarnCore(aId, aBuf, aLength)
2324 #define otDumpNoteCore(aId, aBuf, aLength)
2325 #define otDumpInfoCore(aId, aBuf, aLength)
2326 #define otDumpDebgCore(aId, aBuf, aLength)
2327 #endif
2328 
2329 /**
2330  * @def otDumpCritDua
2331  *
2332  * This function generates a memory dump with log level critical and region Domain Unicast Address.
2333  *
2334  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2335  * @param[in]  aBuf         A pointer to the buffer.
2336  * @param[in]  aLength      Number of bytes to print.
2337  *
2338  */
2339 
2340 /**
2341  * @def otDumpWarnDua
2342  *
2343  * This function generates a memory dump with log level warning and region Domain Unicast Address.
2344  *
2345  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2346  * @param[in]  aBuf         A pointer to the buffer.
2347  * @param[in]  aLength      Number of bytes to print.
2348  *
2349  */
2350 
2351 /**
2352  * @def otDumpNoteDua
2353  *
2354  * This function generates a memory dump with log level note and region Domain Unicast Address.
2355  *
2356  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2357  * @param[in]  aBuf         A pointer to the buffer.
2358  * @param[in]  aLength      Number of bytes to print.
2359  *
2360  */
2361 
2362 /**
2363  * @def otDumpInfoDua
2364  *
2365  * This function generates a memory dump with log level info and region Domain Unicast Address.
2366  *
2367  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2368  * @param[in]  aBuf         A pointer to the buffer.
2369  * @param[in]  aLength      Number of bytes to print.
2370  *
2371  */
2372 
2373 /**
2374  * @def otDumpDebgDua
2375  *
2376  * This function generates a memory dump with log level debug and region Domain Unicast Address.
2377  *
2378  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2379  * @param[in]  aBuf         A pointer to the buffer.
2380  * @param[in]  aLength      Number of bytes to print.
2381  *
2382  */
2383 #if OPENTHREAD_CONFIG_LOG_DUA
2384 #define otDumpCritDua(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_DUA, aId, aBuf, aLength)
2385 #define otDumpWarnDua(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_DUA, aId, aBuf, aLength)
2386 #define otDumpNoteDua(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_DUA, aId, aBuf, aLength)
2387 #define otDumpInfoDua(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_DUA, aId, aBuf, aLength)
2388 #define otDumpDebgDua(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_DUA, aId, aBuf, aLength)
2389 #else
2390 #define otDumpCritDua(aId, aBuf, aLength)
2391 #define otDumpWarnDua(aId, aBuf, aLength)
2392 #define otDumpNoteDua(aId, aBuf, aLength)
2393 #define otDumpInfoDua(aId, aBuf, aLength)
2394 #define otDumpDebgDua(aId, aBuf, aLength)
2395 #endif
2396 
2397 /**
2398  * @def otDumpCritSrp
2399  *
2400  * This function generates a memory dump with log level critical and region Service Registration Protocol (SRP).
2401  *
2402  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2403  * @param[in]  aBuf         A pointer to the buffer.
2404  * @param[in]  aLength      Number of bytes to print.
2405  *
2406  */
2407 
2408 /**
2409  * @def otDumpWarnSrp
2410  *
2411  * This function generates a memory dump with log level warning and region Service Registration Protocol (SRP).
2412  *
2413  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2414  * @param[in]  aBuf         A pointer to the buffer.
2415  * @param[in]  aLength      Number of bytes to print.
2416  *
2417  */
2418 
2419 /**
2420  * @def otDumpNoteSrp
2421  *
2422  * This function generates a memory dump with log level note and region Service Registration Protocol (SRP).
2423  *
2424  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2425  * @param[in]  aBuf         A pointer to the buffer.
2426  * @param[in]  aLength      Number of bytes to print.
2427  *
2428  */
2429 
2430 /**
2431  * @def otDumpInfoSrp
2432  *
2433  * This function generates a memory dump with log level info and region Service Registration Protocol (SRP).
2434  *
2435  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2436  * @param[in]  aBuf         A pointer to the buffer.
2437  * @param[in]  aLength      Number of bytes to print.
2438  *
2439  */
2440 
2441 /**
2442  * @def otDumpDebgSrp
2443  *
2444  * This function generates a memory dump with log level debug and region Service Registration Protocol (SRP).
2445  *
2446  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2447  * @param[in]  aBuf         A pointer to the buffer.
2448  * @param[in]  aLength      Number of bytes to print.
2449  *
2450  */
2451 #if OPENTHREAD_CONFIG_LOG_SRP
2452 #define otDumpCritSrp(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_SRP, aId, aBuf, aLength)
2453 #define otDumpWarnSrp(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_SRP, aId, aBuf, aLength)
2454 #define otDumpNoteSrp(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_SRP, aId, aBuf, aLength)
2455 #define otDumpInfoSrp(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_SRP, aId, aBuf, aLength)
2456 #define otDumpDebgSrp(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_SRP, aId, aBuf, aLength)
2457 #else
2458 #define otDumpCritSrp(aId, aBuf, aLength)
2459 #define otDumpWarnSrp(aId, aBuf, aLength)
2460 #define otDumpNoteSrp(aId, aBuf, aLength)
2461 #define otDumpInfoSrp(aId, aBuf, aLength)
2462 #define otDumpDebgSrp(aId, aBuf, aLength)
2463 #endif
2464 
2465 /**
2466  * @def otDumpCritBr
2467  *
2468  * This function generates a memory dump with log level critical and region Border Routing.
2469  *
2470  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2471  * @param[in]  aBuf         A pointer to the buffer.
2472  * @param[in]  aLength      Number of bytes to print.
2473  *
2474  */
2475 
2476 /**
2477  * @def otDumpWarnBr
2478  *
2479  * This function generates a memory dump with log level warning and region Border Routing.
2480  *
2481  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2482  * @param[in]  aBuf         A pointer to the buffer.
2483  * @param[in]  aLength      Number of bytes to print.
2484  *
2485  */
2486 
2487 /**
2488  * @def otDumpNoteBr
2489  *
2490  * This function generates a memory dump with log level note and region Border Routing.
2491  *
2492  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2493  * @param[in]  aBuf         A pointer to the buffer.
2494  * @param[in]  aLength      Number of bytes to print.
2495  *
2496  */
2497 
2498 /**
2499  * @def otDumpInfoBr
2500  *
2501  * This function generates a memory dump with log level info and region Border Routing.
2502  *
2503  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2504  * @param[in]  aBuf         A pointer to the buffer.
2505  * @param[in]  aLength      Number of bytes to print.
2506  *
2507  */
2508 
2509 /**
2510  * @def otDumpDebgBr
2511  *
2512  * This function generates a memory dump with log level debug and region Border Routing.
2513  *
2514  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2515  * @param[in]  aBuf         A pointer to the buffer.
2516  * @param[in]  aLength      Number of bytes to print.
2517  *
2518  */
2519 #if OPENTHREAD_CONFIG_LOG_BR
2520 #define otDumpCritBr(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_BR, aId, aBuf, aLength)
2521 #define otDumpWarnBr(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_BR, aId, aBuf, aLength)
2522 #define otDumpNoteBr(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_BR, aId, aBuf, aLength)
2523 #define otDumpInfoBr(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_BR, aId, aBuf, aLength)
2524 #define otDumpDebgBr(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_BR, aId, aBuf, aLength)
2525 #else
2526 #define otDumpCritBr(aId, aBuf, aLength)
2527 #define otDumpWarnBr(aId, aBuf, aLength)
2528 #define otDumpNoteBr(aId, aBuf, aLength)
2529 #define otDumpInfoBr(aId, aBuf, aLength)
2530 #define otDumpDebgBr(aId, aBuf, aLength)
2531 #endif
2532 
2533 /**
2534  * @def otDumpCritDns
2535  *
2536  * This function generates a memory dump with log level critical and region DNS.
2537  *
2538  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2539  * @param[in]  aBuf         A pointer to the buffer.
2540  * @param[in]  aLength      Number of bytes to print.
2541  *
2542  */
2543 
2544 /**
2545  * @def otDumpWarnDns
2546  *
2547  * This function generates a memory dump with log level warning and region DNS.
2548  *
2549  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2550  * @param[in]  aBuf         A pointer to the buffer.
2551  * @param[in]  aLength      Number of bytes to print.
2552  *
2553  */
2554 
2555 /**
2556  * @def otDumpNoteDns
2557  *
2558  * This function generates a memory dump with log level note and region DNS.
2559  *
2560  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2561  * @param[in]  aBuf         A pointer to the buffer.
2562  * @param[in]  aLength      Number of bytes to print.
2563  *
2564  */
2565 
2566 /**
2567  * @def otDumpInfoDns
2568  *
2569  * This function generates a memory dump with log level info and region DNS.
2570  *
2571  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2572  * @param[in]  aBuf         A pointer to the buffer.
2573  * @param[in]  aLength      Number of bytes to print.
2574  *
2575  */
2576 
2577 /**
2578  * @def otDumpDebgDns
2579  *
2580  * This function generates a memory dump with log level debug and region DNS.
2581  *
2582  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2583  * @param[in]  aBuf         A pointer to the buffer.
2584  * @param[in]  aLength      Number of bytes to print.
2585  *
2586  */
2587 #if OPENTHREAD_CONFIG_LOG_SRP
2588 #define otDumpCritDns(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_SRP, aId, aBuf, aLength)
2589 #define otDumpWarnDns(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_SRP, aId, aBuf, aLength)
2590 #define otDumpNoteDns(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_SRP, aId, aBuf, aLength)
2591 #define otDumpInfoDns(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_SRP, aId, aBuf, aLength)
2592 #define otDumpDebgDns(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_SRP, aId, aBuf, aLength)
2593 #else
2594 #define otDumpCritDns(aId, aBuf, aLength)
2595 #define otDumpWarnDns(aId, aBuf, aLength)
2596 #define otDumpNoteDns(aId, aBuf, aLength)
2597 #define otDumpInfoDns(aId, aBuf, aLength)
2598 #define otDumpDebgDns(aId, aBuf, aLength)
2599 #endif
2600 
2601 /**
2602  * @def otDumpCritMem
2603  *
2604  * This function generates a memory dump with log level debug and region memory.
2605  *
2606  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2607  * @param[in]  aBuf         A pointer to the buffer.
2608  * @param[in]  aLength      Number of bytes to print.
2609  *
2610  */
2611 
2612 /**
2613  * @def otDumpWarnMem
2614  *
2615  * This function generates a memory dump with log level warning and region memory.
2616  *
2617  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2618  * @param[in]  aBuf         A pointer to the buffer.
2619  * @param[in]  aLength      Number of bytes to print.
2620  *
2621  */
2622 
2623 /**
2624  * @def otDumpNoteMem
2625  *
2626  * This function generates a memory dump with log level note and region memory.
2627  *
2628  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2629  * @param[in]  aBuf         A pointer to the buffer.
2630  * @param[in]  aLength      Number of bytes to print.
2631  *
2632  */
2633 
2634 /**
2635  * @def otDumpInfoMem
2636  *
2637  * This function generates a memory dump with log level info and region memory.
2638  *
2639  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2640  * @param[in]  aBuf         A pointer to the buffer.
2641  * @param[in]  aLength      Number of bytes to print.
2642  *
2643  */
2644 
2645 /**
2646  * @def otDumpDebgMem
2647  *
2648  * This function generates a memory dump with log level debug and region memory.
2649  *
2650  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2651  * @param[in]  aBuf         A pointer to the buffer.
2652  * @param[in]  aLength      Number of bytes to print.
2653  *
2654  */
2655 #if OPENTHREAD_CONFIG_LOG_MEM
2656 #define otDumpCritMem(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_MEM, aId, aBuf, aLength)
2657 #define otDumpWarnMem(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_MEM, aId, aBuf, aLength)
2658 #define otDumpNoteMem(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_MEM, aId, aBuf, aLength)
2659 #define otDumpInfoMem(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_MEM, aId, aBuf, aLength)
2660 #define otDumpDebgMem(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_MEM, aId, aBuf, aLength)
2661 #else
2662 #define otDumpCritMem(aId, aBuf, aLength)
2663 #define otDumpWarnMem(aId, aBuf, aLength)
2664 #define otDumpNoteMem(aId, aBuf, aLength)
2665 #define otDumpInfoMem(aId, aBuf, aLength)
2666 #define otDumpDebgMem(aId, aBuf, aLength)
2667 #endif
2668 
2669 /**
2670  * @def otDumpCertMeshCoP
2671  *
2672  * This function generates a memory dump with log level none for the certification test.
2673  *
2674  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2675  * @param[in]  aBuf         A pointer to the buffer.
2676  * @param[in]  aLength      Number of bytes to print.
2677  *
2678  */
2679 #if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
2680 #define otDumpCertMeshCoP(aId, aBuf, aLength) otDump(OT_LOG_LEVEL_NONE, OT_LOG_REGION_MESH_COP, aId, aBuf, aLength)
2681 #else
2682 #define otDumpCertMeshCoP(aId, aBuf, aLength)
2683 #endif
2684 
2685 /**
2686  * This function dumps bytes to the log in a human-readable fashion.
2687  *
2688  * @param[in]  aLogLevel    The log level.
2689  * @param[in]  aLogRegion   The log region.
2690  * @param[in]  aId          A pointer to a NULL-terminated string that is printed before the bytes.
2691  * @param[in]  aBuf         A pointer to the buffer.
2692  * @param[in]  aLength      Number of bytes to print.
2693  *
2694  */
2695 void otDump(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aId, const void *aBuf, size_t aLength);
2696 
2697 #if OPENTHREAD_CONFIG_LOG_DEFINE_AS_MACRO_ONLY || OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL
2698 /**
2699  * This function converts a log level to a prefix string for appending to log message.
2700  *
2701  * @param[in]  aLogLevel    A log level.
2702  *
2703  * @returns A C string representing the log level.
2704  *
2705  */
2706 const char *otLogLevelToPrefixString(otLogLevel aLogLevel);
2707 #endif
2708 
2709 #if OPENTHREAD_CONFIG_LOG_DEFINE_AS_MACRO_ONLY
2710 
2711 /**
2712  * Local/private macro to format the log message
2713  */
2714 #define _otLogFormatter(aLogLevel, aRegion, ...) \
2715     _otDynamicLog(aLogLevel, aRegion, OT_FIRST_ARG(__VA_ARGS__) OPENTHREAD_CONFIG_LOG_SUFFIX OT_REST_ARGS(__VA_ARGS__))
2716 
2717 #if OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE
2718 
2719 #if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
2720 #error "Dynamic log level is not supported along with multiple OT instance feature"
2721 #endif
2722 
2723 /**
2724  * Local/private macro to dynamically filter log level.
2725  */
2726 #define _otDynamicLog(aLogLevel, aRegion, ...)           \
2727     do                                                   \
2728     {                                                    \
2729         if (otLoggingGetLevel() >= aLogLevel)            \
2730             _otPlatLog(aLogLevel, aRegion, __VA_ARGS__); \
2731     } while (false)
2732 
2733 #else // OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE
2734 
2735 #define _otDynamicLog(aLogLevel, aRegion, ...) _otPlatLog(aLogLevel, aRegion, __VA_ARGS__)
2736 
2737 #endif // OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE
2738 
2739 /**
2740  * `OPENTHREAD_CONFIG_PLAT_LOG_MACRO_NAME` is a configuration parameter (see `config/logging.h`) which specifies the
2741  * function/macro to be used for logging in OpenThread. By default it is set to `otPlatLog()`.
2742  *
2743  */
2744 #define _otPlatLog(aLogLevel, aRegion, ...) OPENTHREAD_CONFIG_PLAT_LOG_MACRO_NAME(aLogLevel, aRegion, __VA_ARGS__)
2745 
2746 #endif // OPENTHREAD_CONFIG_LOG_DEFINE_AS_MACRO_ONLY
2747 
2748 #define _otLogResult(aRegion, aError, ...)                                                 \
2749     do                                                                                     \
2750     {                                                                                      \
2751         otError _err = (aError);                                                           \
2752                                                                                            \
2753         if (_err == OT_ERROR_NONE)                                                         \
2754         {                                                                                  \
2755             otLogInfo##aRegion(OT_FIRST_ARG(__VA_ARGS__) ": %s" OT_REST_ARGS(__VA_ARGS__), \
2756                                otThreadErrorToString(_err));                               \
2757         }                                                                                  \
2758         else                                                                               \
2759         {                                                                                  \
2760             otLogWarn##aRegion(OT_FIRST_ARG(__VA_ARGS__) ": %s" OT_REST_ARGS(__VA_ARGS__), \
2761                                otThreadErrorToString(_err));                               \
2762         }                                                                                  \
2763     } while (false)
2764 
2765 /**
2766  * @def otLogResultPlat
2767  *
2768  * This function generates a log for the Plat region according to the error result. If @p aError is `kErrorNone`, the
2769  * log level is info. Otherwise the log level is warn.
2770  *
2771  * @param[in]  aError    The error result.
2772  * @param[in]  ...       Arguments for the format specification.
2773  *
2774  */
2775 #define otLogResultPlat(aError, ...) _otLogResult(Plat, aError, __VA_ARGS__)
2776 
2777 /**
2778  * @def otLogResultBbr
2779  *
2780  * This function generates a log for the BBR region according to the error result. If @p aError is `OT_ERROR_NONE`, the
2781  * log level is info. Otherwise the log level is warn.
2782  *
2783  * @param[in]  aError    The error result.
2784  * @param[in]  ...       Arguments for the format specification.
2785  *
2786  */
2787 #define otLogResultBbr(aError, ...) _otLogResult(Bbr, aError, __VA_ARGS__)
2788 
2789 #ifdef __cplusplus
2790 }
2791 #endif
2792 
2793 #endif // LOGGING_HPP_
2794