]> sigrok.org Git - libsigrok.git/commitdiff
serial-dmm: only do bytes to text conversion at higher log levels
authorGerhard Sittig <redacted>
Fri, 18 Sep 2020 14:38:54 +0000 (16:38 +0200)
committerGerhard Sittig <redacted>
Sat, 19 Sep 2020 10:32:35 +0000 (12:32 +0200)
Check the current log level before starting the potentially expensive
bytes to text conversion for a debug message (dump DMM packets).

src/hardware/serial-dmm/protocol.c

index 5e8912bf3d21c61906b25b0b21e7bd23b084c8dd..71fc1a4635c480f646859f8ed62a2f63f0b66eca 100644 (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);