AM263Px MCU+ SDK: ub_logging.h File Reference

| AM263Px MCU+ SDK 26.00.00 |

Macros | Typedefs | Functions
ub_logging.h File Reference
APIs for Unibase Binding » Control logging

## Introduction

Control logging by levels and categories.

The logging is controlled by 8 levels which is from UBL_NONE to UBL_DEBUGV. The levels are used, one is for regular console output, and the other is for debug output.

The two levels are set for each category. The categories are defined by user applications, and need to be registered by the initialization string. Registered categories must be enumerated and managed by user. Because category number 0 is used for 'unibase', in user applications starting from category number 1 is recommended.

Go to the source code of this file.

## Macros
#define | UBL_NONE 0
#define | UBL_FATAL 1
#define | UBL_ERROR 2
#define | UBL_WARN 3
#define | UBL_INFO 4
#define | UBL_INFOV 5
#define | UBL_DEBUG 6
#define | UBL_DEBUGV 7
#define | MAX_LOGMSG_CATEGORIES 16
| maximum number of categories More...
#define | DBGMSG_LEVEL_MARK {"NON", "FTL", "ERR", "WRN", "INF", "IFV", "DBG", "DBV"}
| 3-charcter string to represent each logging level More...
#define | UBL_TS_BIT_FIELDS 3
| lowest 2 bits are used for TS Clock type, use ub_clocktype_t UB_CLOCK_DEFAULT means no-timestamp More...
#define | UB_LOG_COMPILE_LEVEL UBL_DEBUGV
#define | UB_LOG_IS_COMPILED(level) (UB_LOG_COMPILE_LEVEL >= level)
#define | UB_LOG_HELPER(level, tstype, ...)
#define | UB_LOG_UBL_DEBUGV(...) UB_LOG_HELPER(UBL_DEBUGV, 0, __VA_ARGS__)
#define | UB_TLOG_UBL_DEBUGV(...) UB_LOG_HELPER(UBL_DEBUGV, UB_LOGTSTYPE, __VA_ARGS__)
#define | UB_LOG_UBL_DEBUG(...) UB_LOG_HELPER(UBL_DEBUG, 0, __VA_ARGS__)
#define | UB_TLOG_UBL_DEBUG(...) UB_LOG_HELPER(UBL_DEBUG, UB_LOGTSTYPE, __VA_ARGS__)
#define | UB_LOG_UBL_INFOV(...) UB_LOG_HELPER(UBL_INFOV, 0, __VA_ARGS__)
#define | UB_TLOG_UBL_INFOV(...) UB_LOG_HELPER(UBL_INFOV, UB_LOGTSTYPE, __VA_ARGS__)
#define | UB_LOG_UBL_INFO(...) UB_LOG_HELPER(UBL_INFO, 0, __VA_ARGS__)
#define | UB_TLOG_UBL_INFO(...) UB_LOG_HELPER(UBL_INFO, UB_LOGTSTYPE, __VA_ARGS__)
#define | UB_LOG_UBL_WARN(...) UB_LOG_HELPER(UBL_WARN, 0, __VA_ARGS__)
#define | UB_TLOG_UBL_WARN(...) UB_LOG_HELPER(UBL_WARN, UB_LOGTSTYPE, __VA_ARGS__)
#define | UB_LOG_UBL_ERROR(...) UB_LOG_HELPER(UBL_ERROR, 0, __VA_ARGS__)
#define | UB_TLOG_UBL_ERROR(...) UB_LOG_HELPER(UBL_ERROR, UB_LOGTSTYPE, __VA_ARGS__)
#define | UB_LOG_UBL_FATAL(...) UB_LOG_HELPER(UBL_FATAL, 0, __VA_ARGS__)
#define | UB_TLOG_UBL_FATAL(...) UB_LOG_HELPER(UBL_FATAL, UB_LOGTSTYPE, __VA_ARGS__)
#define | UB_LOG_UBL_NONE(...)
#define | UB_TLOG_UBL_NONE(...)
#define | UBL_OVERRIDE_ISTR(x, y) ub_log_initstr_override(x,UBB_GETENV(y))
| override valuse 'x' to the value of the environment variable 'y' More...
#define | PRINT_FORMAT_ATTRIBUTE1 __attribute__((format (printf, 1, 2)))
| let the compiler show warning when printf type format is wrong More...
#define | PRINT_FORMAT_ATTRIBUTE4 __attribute__((format (printf, 4, 5)))
| format starts at 4th argument More...

## Typedefs
typedef int | ub_dbgmsg_level_t
| This defines different logging levels. More...

## Functions
void | ub_console_debug_select_print (bool console, bool debug, const char *astr)
| output to console out and debug out by selection More...
const char * | ub_log_initstr_override (const char *ns, const char *os)
| override 'istr' of ub_log_inig More...
void | ub_log_init (const char *istr)
| initialize logging by a string More...
int | ub_log_add_category (const char *catstr)
| add a category of logging at the bottom of the index More...
int | ub_log_print (int cat_index, int flags, ub_dbgmsg_level_t level, const char *astr)
| print log message More...
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 More...
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 More...
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 More...
int | ub_log_return (int cat_index)
| return console log level and console log level to the previous status More...
void | ub_log_flush (void)
| flush out messages on the both of cosole log and debug log More...