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:
Gerhard Sittig 2020-09-18 16:38:54 +02:00
parent ce3fe37969
commit abcb13855f
1 changed files with 3 additions and 0 deletions

View File

@ -31,6 +31,9 @@ static void log_dmm_packet(const uint8_t *buf, size_t len)
{
GString *text;
if (sr_log_loglevel_get() < SR_LOG_DBG)
return;
text = sr_hexdump_new(buf, len);
sr_dbg("DMM packet: %s", text->str);
sr_hexdump_free(text);