mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
log: Add spa_log_hexdump
This commit is contained in:
parent
75af02edcd
commit
1d39ea004e
1 changed files with 18 additions and 0 deletions
|
|
@ -293,6 +293,24 @@ do { \
|
||||||
#define spa_log_trace_fp(l,...)
|
#define spa_log_trace_fp(l,...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define spa_log_hexdump(l,lev,indent,data,len) \
|
||||||
|
({ \
|
||||||
|
char str[512]; \
|
||||||
|
uint8_t *buf = (uint8_t *)data; \
|
||||||
|
size_t i; \
|
||||||
|
int pos; \
|
||||||
|
\
|
||||||
|
for (i = 0; i < len; i++) { \
|
||||||
|
if (i % 16 == 0) \
|
||||||
|
pos = 0; \
|
||||||
|
pos += sprintf(str + pos, "%02x ", buf[i]); \
|
||||||
|
if (i % 16 == 15 || i == len - 1) { \
|
||||||
|
spa_log_log(l,lev,__FILE__,__LINE__,__func__, \
|
||||||
|
"%*s" "%s",indent,"", str); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
})
|
||||||
|
|
||||||
/** \fn spa_log_error */
|
/** \fn spa_log_error */
|
||||||
|
|
||||||
/** keys can be given when initializing the logger handle */
|
/** keys can be given when initializing the logger handle */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue