Skip to content

Commit 8f995f6

Browse files
committed
Add log level function for debugging
1 parent 2b466e7 commit 8f995f6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

core/serial.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ To add a new serial device, you must add an object to
5454
Espruino.Core.Status.incrementProgress(diff);
5555
}
5656
} };
57-
function log(level, str) { if (level<3) console.log("serial:", str); }
57+
58+
// ---------------
59+
var logLevel = 2;
60+
function log(level, str) { if (level<=logLevel) console.log("serial:", str); }
5861
function ab2str(buf) { return String.fromCharCode.apply(null, new Uint8Array(buf)); }
5962
var parseRJSON = data => Espruino.Core.Utils.parseRJSON(data);
6063
// ---------------
@@ -840,6 +843,7 @@ To add a new serial device, you must add an object to
840843
"setBinary": function(isOn) {
841844
sendingBinary = isOn;
842845
},
843-
"connection": new Connection()
846+
"connection": new Connection(),
847+
"debug": function() { logLevel = 3; } // output extra debug info
844848
};
845849
})();

0 commit comments

Comments
 (0)