实现串口驱动,移植方便
This commit is contained in:
81
Middlewares/logging/inc/logging.h
Normal file
81
Middlewares/logging/inc/logging.h
Normal file
@ -0,0 +1,81 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : logging.h
|
||||
* @brief : Logging middleware header file
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
#ifndef LOGGING_H
|
||||
#define LOGGING_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/**
|
||||
* @brief Log levels definitions
|
||||
*/
|
||||
typedef enum {
|
||||
LOG_LEVEL_DEBUG = 0U,
|
||||
LOG_LEVEL_INFO = 1U,
|
||||
LOG_LEVEL_WARN = 2U,
|
||||
LOG_LEVEL_ERROR = 3U,
|
||||
LOG_LEVEL_FATAL = 4U,
|
||||
LOG_LEVEL_NONE = 5U
|
||||
} log_level_t;
|
||||
|
||||
/**
|
||||
* @brief Initialize logging module
|
||||
*/
|
||||
void logging_init(void);
|
||||
|
||||
/**
|
||||
* @brief Set logging level
|
||||
* @param level: Logging level to set
|
||||
*/
|
||||
void logging_set_level(log_level_t level);
|
||||
|
||||
/**
|
||||
* @brief Get current logging level
|
||||
* @retval Current logging level
|
||||
*/
|
||||
log_level_t logging_get_level(void);
|
||||
|
||||
/**
|
||||
* @brief Log debug message
|
||||
* @param format: Format string
|
||||
* @param ...: Variable arguments
|
||||
*/
|
||||
void log_debug(const char *format, ...);
|
||||
|
||||
/**
|
||||
* @brief Log info message
|
||||
* @param format: Format string
|
||||
* @param ...: Variable arguments
|
||||
*/
|
||||
void log_info(const char *format, ...);
|
||||
|
||||
/**
|
||||
* @brief Log warning message
|
||||
* @param format: Format string
|
||||
* @param ...: Variable arguments
|
||||
*/
|
||||
void log_warn(const char *format, ...);
|
||||
|
||||
/**
|
||||
* @brief Log error message
|
||||
* @param format: Format string
|
||||
* @param ...: Variable arguments
|
||||
*/
|
||||
void log_error(const char *format, ...);
|
||||
|
||||
/**
|
||||
* @brief Log fatal message
|
||||
* @param format: Format string
|
||||
* @param ...: Variable arguments
|
||||
*/
|
||||
void log_fatal(const char *format, ...);
|
||||
|
||||
#endif /* LOGGING_H */
|
||||
Reference in New Issue
Block a user