Skip to content
Snippets Groups Projects
Unverified Commit b4a4dfea authored by Roman Azarenko's avatar Roman Azarenko
Browse files

quickjs: remove console.log calls in async-mqtt.js

console.log outputs to stdout. This breaks CLI tools, which use stdout for outputting response JSON data.

QuickJS doesn't support console.warn/console.error. Printing to stderr can be achieved with `std.err.puts()` or
`std.err.printf()`.

Alternatively, this kind of output should be put behind a verbose/debug flag.
parent 3fd75a25
No related branches found
No related tags found
2 merge requests!5Rebase with master,!4quickjs: remove console.log calls in async-mqtt.js
Pipeline #75306 passed
...@@ -18,13 +18,10 @@ class AsyncClient { ...@@ -18,13 +18,10 @@ class AsyncClient {
protobuf.Root.prototype.fetch = function (filename, callback) { protobuf.Root.prototype.fetch = function (filename, callback) {
os.setTimeout(function () { os.setTimeout(function () {
const data = std.loadFile(filename); const data = std.loadFile(filename);
if (data === null) { if (data === null)
console.log("failed to load file: " + filename);
callback(new Error("failed to load file: " + filename)); callback(new Error("failed to load file: " + filename));
} else { else
//console.log(`data loaded for ${filename}`)
callback(null, data); callback(null, data);
}
}, 0); }, 0);
}; };
} }
...@@ -82,7 +79,6 @@ class AsyncClient { ...@@ -82,7 +79,6 @@ class AsyncClient {
// there is no erro handling in paho mqtt // there is no erro handling in paho mqtt
this.client.onConnectionLost = function (responseObject) { this.client.onConnectionLost = function (responseObject) {
callback(responseObject); callback(responseObject);
console.log("USP Disconnected: ", responseObject.errorMessage);
}; };
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment