Files
433_STM32/Core/Inc/debug_log.h

62 lines
1.6 KiB
C
Raw Permalink Normal View History

/**
******************************************************************************
* @file debug_log.h
* @brief
* @author Application Layer
* @version 1.0
******************************************************************************
* @attention
*
* 3.4
*
* [LEVEL][MODULE] message
* [INFO][CMD] Command received: RL
******************************************************************************
*/
#ifndef __DEBUG_LOG_H
#define __DEBUG_LOG_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdbool.h>
typedef enum {
LOG_LEVEL_DEBUG = 0,
LOG_LEVEL_INFO = 1,
LOG_LEVEL_WARN = 2,
LOG_LEVEL_ERROR = 3,
LOG_LEVEL_NONE = 4
} log_level_t;
void DebugLog_Init(void);
void DebugLog_SetLevel(log_level_t level);
log_level_t DebugLog_GetLevel(void);
void DebugLog_EnableModule(const char *module, bool enable);
void DebugLog_Output(log_level_t level, const char *module, const char *fmt, ...);
#define LOG_DEBUG(module, fmt, ...) \
DebugLog_Output(LOG_LEVEL_DEBUG, module, fmt, ##__VA_ARGS__)
#define LOG_INFO(module, fmt, ...) \
DebugLog_Output(LOG_LEVEL_INFO, module, fmt, ##__VA_ARGS__)
#define LOG_WARN(module, fmt, ...) \
DebugLog_Output(LOG_LEVEL_WARN, module, fmt, ##__VA_ARGS__)
#define LOG_ERROR(module, fmt, ...) \
DebugLog_Output(LOG_LEVEL_ERROR, module, fmt, ##__VA_ARGS__)
#ifdef __cplusplus
}
#endif
#endif