mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-10-20 18:29:42 +02: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.Encoder;
|
||||||
import ch.qos.logback.core.encoder.LayoutWrappingEncoder;
|
import ch.qos.logback.core.encoder.LayoutWrappingEncoder;
|
||||||
import ch.qos.logback.core.util.StatusPrinter;
|
import ch.qos.logback.core.util.StatusPrinter;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||||
|
|
||||||
public abstract class Logging {
|
public abstract class Logging {
|
||||||
public static final String PROP_LOGFILES_DIR = "GB_LOGFILES_DIR";
|
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) {
|
public static void logBytes(Logger logger, byte[] value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
for (byte b : value) {
|
logger.warn("DATA: " + GB.hexdump(value, 0, value.length));
|
||||||
logger.warn("DATA: " + String.format("0x%2x", b));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1056,9 +1056,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
|||||||
if (value.length != 1) {
|
if (value.length != 1) {
|
||||||
LOG.error("Notifications should be 1 byte long.");
|
LOG.error("Notifications should be 1 byte long.");
|
||||||
LOG.info("RECEIVED DATA WITH LENGTH: " + value.length);
|
LOG.info("RECEIVED DATA WITH LENGTH: " + value.length);
|
||||||
for (byte b : value) {
|
LOG.warn("DATA: " + GB.hexdump(value, 0, value.length));
|
||||||
LOG.warn("DATA: " + String.format("0x%2x", b));
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (value[0]) {
|
switch (value[0]) {
|
||||||
@ -1087,9 +1085,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
|||||||
LOG.info("Setting latency succeeded.");
|
LOG.info("Setting latency succeeded.");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
for (byte b : value) {
|
LOG.warn("DATA: " + GB.hexdump(value, 0, value.length));
|
||||||
LOG.warn("DATA: " + String.format("0x%2x", b));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1297,9 +1293,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
|||||||
|
|
||||||
if ((value.length - 2) % 6 != 0) {
|
if ((value.length - 2) % 6 != 0) {
|
||||||
LOG.warn("GOT UNEXPECTED SENSOR DATA WITH LENGTH: " + value.length);
|
LOG.warn("GOT UNEXPECTED SENSOR DATA WITH LENGTH: " + value.length);
|
||||||
for (byte b : value) {
|
LOG.warn("DATA: " + GB.hexdump(value, 0, value.length));
|
||||||
LOG.warn("DATA: " + String.format("0x%4x", b));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
counter = (value[0] & 0xff) | ((value[1] & 0xff) << 8);
|
counter = (value[0] & 0xff) | ((value[1] & 0xff) << 8);
|
||||||
|
Loading…
Reference in New Issue
Block a user