serial-dmm: only do bytes to text conversion at higher log levels
Check the current log level before starting the potentially expensive bytes to text conversion for a debug message (dump DMM packets).
This commit is contained in:
parent
ce3fe37969
commit
abcb13855f
|
@ -31,6 +31,9 @@ static void log_dmm_packet(const uint8_t *buf, size_t len)
|
||||||
{
|
{
|
||||||
GString *text;
|
GString *text;
|
||||||
|
|
||||||
|
if (sr_log_loglevel_get() < SR_LOG_DBG)
|
||||||
|
return;
|
||||||
|
|
||||||
text = sr_hexdump_new(buf, len);
|
text = sr_hexdump_new(buf, len);
|
||||||
sr_dbg("DMM packet: %s", text->str);
|
sr_dbg("DMM packet: %s", text->str);
|
||||||
sr_hexdump_free(text);
|
sr_hexdump_free(text);
|
||||||
|
|
Loading…
Reference in New Issue