mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-24 19:06:53 +01:00
Reduce the amount of lines in the logcat for binary dumps
Concatenate the binary values instead of logging one byte per line.
This commit is contained in:
parent
c6b23041f7
commit
2a30e9486c
@ -30,6 +30,7 @@ import ch.qos.logback.core.FileAppender;
|
||||
import ch.qos.logback.core.encoder.Encoder;
|
||||
import ch.qos.logback.core.encoder.LayoutWrappingEncoder;
|
||||
import ch.qos.logback.core.util.StatusPrinter;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||
|
||||
public abstract class Logging {
|
||||
public static final String PROP_LOGFILES_DIR = "GB_LOGFILES_DIR";
|
||||
@ -156,9 +157,7 @@ public abstract class Logging {
|
||||
|
||||
public static void logBytes(Logger logger, byte[] value) {
|
||||
if (value != null) {
|
||||
for (byte b : value) {
|
||||
logger.warn("DATA: " + String.format("0x%2x", b));
|
||||
}
|
||||
logger.warn("DATA: " + GB.hexdump(value, 0, value.length));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1056,9 +1056,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
||||
if (value.length != 1) {
|
||||
LOG.error("Notifications should be 1 byte long.");
|
||||
LOG.info("RECEIVED DATA WITH LENGTH: " + value.length);
|
||||
for (byte b : value) {
|
||||
LOG.warn("DATA: " + String.format("0x%2x", b));
|
||||
}
|
||||
LOG.warn("DATA: " + GB.hexdump(value, 0, value.length));
|
||||
return;
|
||||
}
|
||||
switch (value[0]) {
|
||||
@ -1087,9 +1085,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
||||
LOG.info("Setting latency succeeded.");
|
||||
break;
|
||||
default:
|
||||
for (byte b : value) {
|
||||
LOG.warn("DATA: " + String.format("0x%2x", b));
|
||||
}
|
||||
LOG.warn("DATA: " + GB.hexdump(value, 0, value.length));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1297,9 +1293,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
||||
|
||||
if ((value.length - 2) % 6 != 0) {
|
||||
LOG.warn("GOT UNEXPECTED SENSOR DATA WITH LENGTH: " + value.length);
|
||||
for (byte b : value) {
|
||||
LOG.warn("DATA: " + String.format("0x%4x", b));
|
||||
}
|
||||
LOG.warn("DATA: " + GB.hexdump(value, 0, value.length));
|
||||
}
|
||||
else {
|
||||
counter = (value[0] & 0xff) | ((value[1] & 0xff) << 8);
|
||||
|
Loading…
Reference in New Issue
Block a user