1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-26 06:53:52 +01:00
RIOT/cpu/esp_common/include/log_module.h
2025-09-12 11:50:26 +02:00

56 lines
1.3 KiB
C

/*
* SPDX-FileCopyrightText: 2019 Gunar Schorcht
* SPDX-License-Identifier: LGPL-2.1-only
*/
#pragma once
/**
* @ingroup cpu_esp_common
* @{
*
* @file
* @brief Log module to realize consistent log messages for ESP SoCs
*
* @author Gunar Schorcht <gunar@schorcht.net>
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include "esp_common_log.h"
#ifdef MODULE_LOG_PRINTFNOFORMAT
static inline void log_write(unsigned level, const char *format, ...) {
(void)level;
puts(format);
}
#else /* MODULE_LOG_PRINTFNOFORMAT */
#define log_write(level, ...) \
do { \
if (level == LOG_ERROR) { \
LOG_TAG(LOG_ERROR, E, __func__, ##__VA_ARGS__); \
} \
else if (level == LOG_WARNING) { \
LOG_TAG(LOG_WARNING, W, __func__, ##__VA_ARGS__); \
} \
else if (level == LOG_INFO) { \
LOG_TAG(LOG_INFO, D, __func__, ##__VA_ARGS__); \
} \
else if (level == LOG_DEBUG) { \
LOG_TAG(LOG_DEBUG, E, __func__, ##__VA_ARGS__); \
} \
} while (0U)
#endif /* MODULE_LOG_PRINTFNOFORMAT */
#ifdef __cplusplus
}
#endif
/**@}*/