mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2025-08-03 02:18:34 +00:00
Removed Debug
On some devices it looks like removing the System.println() statements from inside an 'if' clause whose condition is a constant (static constant Globals.scDebug) makes a memory saving. This would suggest the compiler does not propagate constants and prune unreachable code. However in the device of greatest interest debug removal has made no difference to the memory usage. Here the conditional clauses have been turned into comments that can be removed on a case-by-case basis otherwise the debug printing is too voluminous anyway.
This commit is contained in:
@ -78,9 +78,7 @@ class WebLog {
|
||||
var myTime = System.getClockTime();
|
||||
buffer += myTime.hour.format("%02d") + ":" + myTime.min.format("%02d") + ":" + myTime.sec.format("%02d") + " " + str;
|
||||
numCalls++;
|
||||
if (Globals.scDebug) {
|
||||
System.println("WebLog print() str = " + str);
|
||||
}
|
||||
// System.println("WebLog print() str = " + str);
|
||||
if (numCalls >= callsbuffer) {
|
||||
doPrint();
|
||||
}
|
||||
@ -97,9 +95,7 @@ class WebLog {
|
||||
// submission level set by 'callsbuffer'.
|
||||
//
|
||||
function flush() {
|
||||
if (Globals.scDebug) {
|
||||
System.println("WebLog flush()");
|
||||
}
|
||||
// System.println("WebLog flush()");
|
||||
if (numCalls > 0) {
|
||||
doPrint();
|
||||
}
|
||||
@ -108,10 +104,8 @@ class WebLog {
|
||||
// Perform the submission to the online logger.
|
||||
//
|
||||
function doPrint() {
|
||||
if (Globals.scDebug) {
|
||||
System.println("WebLog doPrint()");
|
||||
System.println(buffer);
|
||||
}
|
||||
// System.println("WebLog doPrint()");
|
||||
// System.println(buffer);
|
||||
Communications.makeWebRequest(
|
||||
ClientId.webLogUrl,
|
||||
{
|
||||
@ -134,9 +128,7 @@ class WebLog {
|
||||
// execution.
|
||||
//
|
||||
function clear() {
|
||||
if (Globals.scDebug) {
|
||||
System.println("WebLog clear()");
|
||||
}
|
||||
// System.println("WebLog clear()");
|
||||
Communications.makeWebRequest(
|
||||
ClientId.webLogClearUrl,
|
||||
{},
|
||||
@ -156,24 +148,20 @@ class WebLog {
|
||||
// Callback function to print the outcome of a doPrint() method.
|
||||
//
|
||||
function onLog(responseCode as Lang.Number, data as Null or Lang.Dictionary or Lang.String) as Void {
|
||||
if (Globals.scDebug) {
|
||||
if (responseCode != 200) {
|
||||
System.println("WebLog onLog() Failed");
|
||||
System.println("WebLog onLog() Response Code: " + responseCode);
|
||||
System.println("WebLog onLog() Response Data: " + data);
|
||||
}
|
||||
}
|
||||
// if (responseCode != 200) {
|
||||
// System.println("WebLog onLog() Failed");
|
||||
// System.println("WebLog onLog() Response Code: " + responseCode);
|
||||
// System.println("WebLog onLog() Response Data: " + data);
|
||||
// }
|
||||
}
|
||||
|
||||
// Callback function to print the outcome of a clear() method.
|
||||
//
|
||||
function onClear(responseCode as Lang.Number, data as Null or Lang.Dictionary or Lang.String) as Void {
|
||||
if (Globals.scDebug) {
|
||||
if (responseCode != 200) {
|
||||
System.println("WebLog onClear() Failed");
|
||||
System.println("WebLog onClear() Response Code: " + responseCode);
|
||||
System.println("WebLog onClear() Response Data: " + data);
|
||||
}
|
||||
}
|
||||
// if (responseCode != 200) {
|
||||
// System.println("WebLog onClear() Failed");
|
||||
// System.println("WebLog onClear() Response Code: " + responseCode);
|
||||
// System.println("WebLog onClear() Response Data: " + data);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user