log_module.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2019 Gunar Schorcht
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 #include <stdio.h>
23 #include "esp_common_log.h"
24 
25 #ifdef MODULE_LOG_PRINTFNOFORMAT
26 
27 static inline void log_write(unsigned level, const char *format, ...) {
28  (void)level;
29  puts(format);
30 }
31 
32 #else /* MODULE_LOG_PRINTFNOFORMAT */
33 
34 #define log_write(level, ...) \
35  do { \
36  if (level == LOG_ERROR) { \
37  LOG_TAG(LOG_ERROR, E, __func__, ##__VA_ARGS__); \
38  } \
39  else if (level == LOG_WARNING) { \
40  LOG_TAG(LOG_WARNING, W, __func__, ##__VA_ARGS__); \
41  } \
42  else if (level == LOG_INFO) { \
43  LOG_TAG(LOG_INFO, D, __func__, ##__VA_ARGS__); \
44  } \
45  else if (level == LOG_DEBUG) { \
46  LOG_TAG(LOG_DEBUG, E, __func__, ##__VA_ARGS__); \
47  } \
48  } while (0U)
49 
50 #endif /* MODULE_LOG_PRINTFNOFORMAT */
51 
52 #ifdef __cplusplus
53 }
54 #endif
Common log macros for ESP SoCs.
void log_write(unsigned level, const char *format,...)
log_write overridden function for colored output