#ifndef __SCC_POS_LOG_H__ #define __SCC_POS_LOG_H__ #include "scc_pos.h" #include extern logger_t __scc_usr_log; #define SCC_POS_LOG(level, pos, fmt, ...) \ do { \ char _full_msg[LOGGER_MAX_BUF_SIZE]; \ int _n = scc_snprintf(_full_msg, sizeof(_full_msg), \ scc_pos_pnt_fmt ": ", scc_pos_pnt_val(pos)); \ scc_snprintf(_full_msg + _n, sizeof(_full_msg) - _n, fmt, \ ##__VA_ARGS__); \ __scc_usr_log.handler(&__scc_usr_log, level, nullptr, 0, nullptr, \ "%s", _full_msg); \ } while (0) #define SCC_DEBUG(pos, fmt, ...) \ SCC_POS_LOG(LOG_LEVEL_DEBUG, pos, fmt, ##__VA_ARGS__) #define SCC_INFO(pos, fmt, ...) \ SCC_POS_LOG(LOG_LEVEL_INFO, pos, fmt, ##__VA_ARGS__) #define SCC_WARN(pos, fmt, ...) \ SCC_POS_LOG(LOG_LEVEL_WARN, pos, fmt, ##__VA_ARGS__) #define SCC_ERROR(pos, fmt, ...) \ SCC_POS_LOG(LOG_LEVEL_ERROR, pos, fmt, ##__VA_ARGS__) #define SCC_FATAL(pos, fmt, ...) \ SCC_POS_LOG(LOG_LEVEL_FATAL, pos, fmt, ##__VA_ARGS__) #endif /* __SCC_POS_LOG_H__ */