Loading...
Searching...
No Matches
log_module.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2019 Gunar Schorcht
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
19#ifndef LOG_MODULE_H
20#define LOG_MODULE_H
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#include <stdio.h>
27#include "esp_common_log.h"
28
29#ifdef MODULE_LOG_PRINTFNOFORMAT
30
31static inline void log_write(unsigned level, const char *format, ...) {
32 (void)level;
33 puts(format);
34}
35
36#else /* MODULE_LOG_PRINTFNOFORMAT */
37
38#define log_write(level, ...) \
39 do { \
40 if (level == LOG_ERROR) { \
41 LOG_TAG(LOG_ERROR, E, __func__, ##__VA_ARGS__); \
42 } \
43 else if (level == LOG_WARNING) { \
44 LOG_TAG(LOG_WARNING, W, __func__, ##__VA_ARGS__); \
45 } \
46 else if (level == LOG_INFO) { \
47 LOG_TAG(LOG_INFO, D, __func__, ##__VA_ARGS__); \
48 } \
49 else if (level == LOG_DEBUG) { \
50 LOG_TAG(LOG_DEBUG, E, __func__, ##__VA_ARGS__); \
51 } \
52 } while (0U)
53
54#endif /* MODULE_LOG_PRINTFNOFORMAT */
55
56#ifdef __cplusplus
57}
58#endif
60#endif /* LOG_MODULE_H */
#define log_write(level,...)
Default log_write function, just maps to printf.
Definition log.h:106
Common log macros for ESP SoCs.
stdio wrapper to extend the C libs stdio