75 lines
1.1 KiB
C
75 lines
1.1 KiB
C
//
|
|
// Created by ilya on 13.02.23.
|
|
//
|
|
|
|
#ifndef UVEOS_ON_NATION_LOG_H
|
|
#define UVEOS_ON_NATION_LOG_H
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
|
|
#ifndef LOG_ENABLE
|
|
#define LOG_ENABLE 1
|
|
#endif
|
|
|
|
#if LOG_ENABLE
|
|
|
|
#include <stdio.h>
|
|
|
|
#define LOG_NONE 0
|
|
#define LOG_ERROR 10
|
|
#define LOG_WARNING 20
|
|
#define LOG_INFO 30
|
|
#define LOG_DEBUG 40
|
|
|
|
#ifndef LOG_LEVEL
|
|
#define LOG_LEVEL LOG_DEBUG
|
|
#endif
|
|
|
|
#if LOG_LEVEL >= LOG_INFO
|
|
#define log_info(...) printf(__VA_ARGS__)
|
|
#else
|
|
#define log_info(...)
|
|
#endif
|
|
|
|
#if LOG_LEVEL >= LOG_ERROR
|
|
#define log_error(...) printf(__VA_ARGS__)
|
|
#else
|
|
#define log_error(...)
|
|
#endif
|
|
|
|
#if LOG_LEVEL >= LOG_WARNING
|
|
#define log_warning(...) printf(__VA_ARGS__)
|
|
#else
|
|
#define log_warning(...)
|
|
#endif
|
|
|
|
#if LOG_LEVEL >= LOG_DEBUG
|
|
#define log_debug(...) printf(__VA_ARGS__)
|
|
#else
|
|
#define log_debug(...)
|
|
#endif
|
|
|
|
void log_init(void);
|
|
|
|
#else /* !LOG_ENABLE */
|
|
|
|
#define log_info(...)
|
|
#define log_warning(...)
|
|
#define log_error(...)
|
|
#define log_debug(...)
|
|
#define log_init()
|
|
|
|
#endif
|
|
|
|
#define log_func() log_debug("call %s\r\n", __FUNCTION__)
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
|
|
#endif //UVEOS_ON_NATION_LOG_H
|