Logging library for Unify applications and components.
More...
|
#define | sl_log_byte_arr(tag, lvl, _arr, _arr_len) |
|
#define | COLOR_START "\033[32;1m" |
|
#define | COLOR_END "\033[0m" |
|
#define | sl_log_debug(tag, fmtstr, ...) sl_log(tag, SL_LOG_DEBUG, fmtstr, ##__VA_ARGS__) |
|
#define | sl_log_info(tag, fmtstr, ...) sl_log(tag, SL_LOG_INFO, fmtstr, ##__VA_ARGS__) |
|
#define | sl_log_warning(tag, fmtstr, ...) sl_log(tag, SL_LOG_WARNING, fmtstr, ##__VA_ARGS__) |
|
#define | sl_log_error(tag, fmtstr, ...) sl_log(tag, SL_LOG_ERROR, fmtstr, ##__VA_ARGS__) |
|
#define | sl_log_critical(tag, fmtstr, ...) sl_log(tag, SL_LOG_CRITICAL, fmtstr, ##__VA_ARGS__) |
|
Logging library for Unify applications and components.
Logging library for Unify based on boost::log and wrapped with C headers. The logging system features log scoping and filtering. All Unify components should use the logging system for printing messages.
◆ COLOR_END
#define COLOR_END "\033[0m" |
◆ COLOR_START
#define COLOR_START "\033[32;1m" |
◆ sl_log_byte_arr
#define sl_log_byte_arr |
( |
|
tag, |
|
|
|
lvl, |
|
|
|
_arr, |
|
|
|
_arr_len |
|
) |
| |
Value: { \
char _tmp_log_arr[_arr_len * 2 + 1] = {0}; \
char *_cur_log_arr_idx = _tmp_log_arr; \
for (unsigned int _log_arr_count = 0; _log_arr_count < _arr_len; \
_log_arr_count++) { \
_cur_log_arr_idx \
+= snprintf(_cur_log_arr_idx, \
sizeof(_tmp_log_arr) - (_cur_log_arr_idx - _tmp_log_arr), \
"%02X", \
(_arr)[_log_arr_count]); \
} \
sl_log(tag, lvl, "%s\n", _tmp_log_arr); \
}
log a byte array as hex string.
◆ sl_log_critical
◆ sl_log_debug
#define sl_log_debug |
( |
|
tag, |
|
|
|
fmtstr, |
|
|
|
... |
|
) |
| sl_log(tag, SL_LOG_DEBUG, fmtstr, ##__VA_ARGS__) |
◆ sl_log_error
#define sl_log_error |
( |
|
tag, |
|
|
|
fmtstr, |
|
|
|
... |
|
) |
| sl_log(tag, SL_LOG_ERROR, fmtstr, ##__VA_ARGS__) |
◆ sl_log_info
#define sl_log_info |
( |
|
tag, |
|
|
|
fmtstr, |
|
|
|
... |
|
) |
| sl_log(tag, SL_LOG_INFO, fmtstr, ##__VA_ARGS__) |
◆ sl_log_warning
◆ sl_log_level_t
◆ sl_log_level
Log levels.
Enumerator |
---|
SL_LOG_DEBUG | |
SL_LOG_INFO | |
SL_LOG_WARNING | |
SL_LOG_ERROR | |
SL_LOG_CRITICAL | |
◆ sl_log()
void sl_log |
( |
const char *const |
tag, |
|
|
sl_log_level_t |
level, |
|
|
const char * |
fmtstr, |
|
|
|
... |
|
) |
| |
Write to the log.
- Parameters
-
tag | Log tag to use |
level | Log level |
fmtstr | Formatted string (printf style) |
... | arguments for the string |
◆ sl_log_get_level()
Get log level.
- Returns
- log level
◆ sl_log_level_from_string()
Convert sl_log_level as string to sl_log_level_t.
- Parameters
-
level | string representation of sl_log_level_t, supported values are: "d", "debug" "i", "info" "w", "warning" "e", "error" "c", "critical" |
result | |
- Returns
- sl_status_t
◆ sl_log_read_config()
void sl_log_read_config |
( |
| ) |
|
Read configuration from config library.
◆ sl_log_set_level()
Set log level.
- Parameters
-
◆ sl_log_set_tag_level()
Set log level for a given tag.
This level will override the log level set in sl_log_set_level To remove a tag specific log level use sl_log_unset_tag_level
- Parameters
-
tag | tag to set log level for |
level | log level to set for the tag |
◆ sl_log_unset_tag_level()
void sl_log_unset_tag_level |
( |
const char * |
tag | ) |
|
Remove tag specific log level for tag.
By removing the tag specific log level, the log level for the tag will use the log level set by sl_log_set_level
- Parameters
-
tag | tag to unset specific log level for |