Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
Loading...
Searching...
No Matches
esp_log.h
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: 2022 Gunar Schorcht
3
* SPDX-License-Identifier: LGPL-2.1-only
4
*/
5
6
#pragma once
7
18
19
#ifndef DOXYGEN
/* Hide implementation details from doxygen */
20
21
#ifdef __cplusplus
22
extern
"C"
{
23
#endif
24
25
#include "log.h"
26
#include_next "esp_log.h"
27
28
#if defined(RIOT_VERSION)
29
30
#include "
esp_common.h
"
31
32
#ifndef LOG_LOCAL_LEVEL
33
#define LOG_LOCAL_LEVEL LOG_LEVEL
34
#endif
35
36
#define ESP_LOG_LEVEL(level, tag, format, ...) \
37
do { \
38
if ((esp_log_level_t)level==ESP_LOG_ERROR ) { \
39
ESP_LOGE(tag, format, ##__VA_ARGS__); \
40
} \
41
else if ((esp_log_level_t)level==ESP_LOG_WARN ) { \
42
ESP_LOGW(tag, format, ##__VA_ARGS__); \
43
} \
44
else if ((esp_log_level_t)level==ESP_LOG_INFO ) { \
45
ESP_LOGI(tag, format, ##__VA_ARGS__); \
46
} \
47
else if ((esp_log_level_t)level==ESP_LOG_DEBUG ) { \
48
ESP_LOGD(tag, format, ##__VA_ARGS__); \
49
} \
50
else if ((esp_log_level_t)level==ESP_LOG_VERBOSE ) { \
51
ESP_LOGV(tag, format, ##__VA_ARGS__); \
52
} \
53
} while (0)
54
55
#define ESP_LOG_LEVEL_LOCAL(level, tag, format, ...) \
56
do { \
57
if ( LOG_LOCAL_LEVEL >= level ) { \
58
ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \
59
} \
60
} while (0)
61
62
#define ESP_LOGE(tag, format, ...) esp_log_write((esp_log_level_t)LOG_ERROR , tag, format "\n", ##__VA_ARGS__)
63
#define ESP_LOGW(tag, format, ...) esp_log_write((esp_log_level_t)LOG_WARNING, tag, format "\n", ##__VA_ARGS__)
64
#define ESP_LOGI(tag, format, ...) esp_log_write((esp_log_level_t)LOG_INFO , tag, format "\n", ##__VA_ARGS__)
65
#define ESP_LOGD(tag, format, ...) esp_log_write((esp_log_level_t)LOG_DEBUG , tag, format "\n", ##__VA_ARGS__)
66
#define ESP_LOGV(tag, format, ...) esp_log_write((esp_log_level_t)LOG_ALL , tag, format "\n", ##__VA_ARGS__)
67
68
#if MODULE_ESP_LOG_TAGGED
69
70
#define ESP_DRAM_LOG_LEVEL(level, letter, tag, format, ...) \
71
do { \
72
if ((esp_log_level_t)LOG_LOCAL_LEVEL >= level ) { \
73
esp_rom_printf(DRAM_STR(LOG_FORMAT(letter, format)), \
74
system_get_time_ms(), ##__VA_ARGS__); \
75
}\
76
} while (0U)
77
78
#else
79
80
#define ESP_DRAM_LOG_LEVEL(level, letter, tag, format, ...) \
81
do { \
82
if ((esp_log_level_t)LOG_LOCAL_LEVEL >= level ) { \
83
esp_rom_printf(DRAM_STR(LOG_FORMAT(letter, format)), \
84
##__VA_ARGS__); \
85
}\
86
} while (0U)
87
88
#endif
89
90
#define ESP_DRAM_LOGE(tag, format, ...) ESP_DRAM_LOG_LEVEL(LOG_ERROR , E, tag, format "\n", ##__VA_ARGS__)
91
#define ESP_DRAM_LOGW(tag, format, ...) ESP_DRAM_LOG_LEVEL(LOG_WARNING, W, tag, format "\n", ##__VA_ARGS__)
92
#define ESP_DRAM_LOGI(tag, format, ...) ESP_DRAM_LOG_LEVEL(LOG_INFO , I, tag, format "\n", ##__VA_ARGS__)
93
#define ESP_DRAM_LOGD(tag, format, ...) ESP_DRAM_LOG_LEVEL(LOG_DEBUG , D, tag, format "\n", ##__VA_ARGS__)
94
#define ESP_DRAM_LOGV(tag, format, ...) ESP_DRAM_LOG_LEVEL(LOG_ALL , V, tag, format "\n", ##__VA_ARGS__)
95
96
#endif
/* defined(RIOT_VERSION) */
97
98
#ifdef __cplusplus
99
}
100
#endif
101
102
#endif
/* DOXYGEN */
esp_common.h
Common helper macros for ESP SoCs.
Generated on Mon Sep 15 2025 13:46:10 by
1.13.2