|
AM263x MCU+ SDK
10.00.00
|
|
Go to the documentation of this file.
99 #ifndef MAX_LOGMSG_CATEGORIES
101 #define MAX_LOGMSG_CATEGORIES 16
107 #define DBGMSG_LEVEL_MARK {"NON", "FTL", "ERR", "WRN", "INF", "IFV", "DBG", "DBV"}
113 #define UBL_TS_BIT_FIELDS 3 // bit0 and bit1
115 #ifndef UB_LOG_COMPILE_LEVEL
116 #define UB_LOG_COMPILE_LEVEL UBL_DEBUGV
119 #define UB_LOG_IS_COMPILED(level) (UB_LOG_COMPILE_LEVEL >= level)
121 #define UB_LOG_HELPER(level, tstype, ...) \
123 char coutstr[UB_CHARS_IN_LINE]; \
124 (void)snprintf(coutstr, UB_CHARS_IN_LINE, __VA_ARGS__); \
125 (void)ub_log_print(UB_LOGCAT, tstype, level, coutstr); \
128 #if UB_LOG_IS_COMPILED(UBL_DEBUGV)
129 #define UB_LOG_UBL_DEBUGV(...) UB_LOG_HELPER(UBL_DEBUGV, 0, __VA_ARGS__)
130 #define UB_TLOG_UBL_DEBUGV(...) UB_LOG_HELPER(UBL_DEBUGV, UB_LOGTSTYPE, __VA_ARGS__)
132 #define UB_LOG_UBL_DEBUGV(...)
133 #define UB_TLOG_UBL_DEBUGV(...)
136 #if UB_LOG_IS_COMPILED(UBL_DEBUG)
137 #define UB_LOG_UBL_DEBUG(...) UB_LOG_HELPER(UBL_DEBUG, 0, __VA_ARGS__)
138 #define UB_TLOG_UBL_DEBUG(...) UB_LOG_HELPER(UBL_DEBUG, UB_LOGTSTYPE, __VA_ARGS__)
140 #define UB_LOG_UBL_DEBUG(...)
141 #define UB_TLOG_UBL_DEBUG(...)
144 #if UB_LOG_IS_COMPILED(UBL_INFOV)
145 #define UB_LOG_UBL_INFOV(...) UB_LOG_HELPER(UBL_INFOV, 0, __VA_ARGS__)
146 #define UB_TLOG_UBL_INFOV(...) UB_LOG_HELPER(UBL_INFOV, UB_LOGTSTYPE, __VA_ARGS__)
148 #define UB_LOG_UBL_INFOV(...)
149 #define UB_TLOG_UBL_INFOV(...)
152 #if UB_LOG_IS_COMPILED(UBL_INFO)
153 #define UB_LOG_UBL_INFO(...) UB_LOG_HELPER(UBL_INFO, 0, __VA_ARGS__)
154 #define UB_TLOG_UBL_INFO(...) UB_LOG_HELPER(UBL_INFO, UB_LOGTSTYPE, __VA_ARGS__)
156 #define UB_LOG_UBL_INFO(...)
157 #define UB_TLOG_UBL_INFO(...)
160 #if UB_LOG_IS_COMPILED(UBL_WARN)
161 #define UB_LOG_UBL_WARN(...) UB_LOG_HELPER(UBL_WARN, 0, __VA_ARGS__)
162 #define UB_TLOG_UBL_WARN(...) UB_LOG_HELPER(UBL_WARN, UB_LOGTSTYPE, __VA_ARGS__)
164 #define UB_LOG_UBL_WARN(...)
165 #define UB_TLOG_UBL_WARN(...)
168 #if UB_LOG_IS_COMPILED(UBL_ERROR)
169 #define UB_LOG_UBL_ERROR(...) UB_LOG_HELPER(UBL_ERROR, 0, __VA_ARGS__)
170 #define UB_TLOG_UBL_ERROR(...) UB_LOG_HELPER(UBL_ERROR, UB_LOGTSTYPE, __VA_ARGS__)
172 #define UB_LOG_UBL_ERROR(...)
173 #define UB_TLOG_UBL_ERROR(...)
176 #if UB_LOG_IS_COMPILED(UBL_FATAL)
177 #define UB_LOG_UBL_FATAL(...) UB_LOG_HELPER(UBL_FATAL, 0, __VA_ARGS__)
178 #define UB_TLOG_UBL_FATAL(...) UB_LOG_HELPER(UBL_FATAL, UB_LOGTSTYPE, __VA_ARGS__)
180 #define UB_LOG_UBL_FATAL(...)
181 #define UB_TLOG_UBL_FATAL(...)
184 #define UB_LOG_UBL_NONE(...)
185 #define UB_TLOG_UBL_NONE(...)
191 #define UBL_OVERRIDE_ISTR(x,y) ub_log_initstr_override(x,UBB_GETENV(y))
193 #ifdef PRINT_FORMAT_NO_WARNING
195 #define PRINT_FORMAT_ATTRIBUTE1
196 #define PRINT_FORMAT_ATTRIBUTE4
199 #define PRINT_FORMAT_ATTRIBUTE1 __attribute__((format (printf, 1, 2)))
200 #define PRINT_FORMAT_ATTRIBUTE4 __attribute__((format (printf, 4, 5)))
int ub_log_return(int cat_index)
return console log level and console log level to the previous status
const char * ub_log_initstr_override(const char *ns, const char *os)
override 'istr' of ub_log_inig
int ub_log_add_category(const char *catstr)
add a category of logging at the bottom of the index
int ub_log_print(int cat_index, int flags, ub_dbgmsg_level_t level, const char *astr)
print log message
uint8_t flags
Definition: hsmclient_msg.h:2
void ub_log_flush(void)
flush out messages on the both of cosole log and debug log
bool ub_clog_on(int cat_index, ub_dbgmsg_level_t level)
check if console log is enabled or not for the indicated cat_index and level
int ub_dbgmsg_level_t
This defines different logging levels.
Definition: ub_logging.h:88
void ub_log_init(const char *istr)
initialize logging by a string
int ub_log_change(int cat_index, ub_dbgmsg_level_t clevel, ub_dbgmsg_level_t dlevel)
change console log level to clevel, and debug log level to delevl
bool ub_dlog_on(int cat_index, ub_dbgmsg_level_t level)
check if debug log is enabled or not for the indicated cat_index and level
void ub_console_debug_select_print(bool console, bool debug, const char *astr)
output to console out and debug out by selection