Add a callback handler to wrapper

Added a callback handler to the appendfile.
This commit is contained in:
MissFox0810 2019-09-07 03:15:39 +01:00 committed by GitHub
parent 1e81a38ab4
commit 155bc850b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,7 +57,9 @@ var poll = function( ) {
if (json.Message !== undefined && json.Message.length > 0) {
console.log(json.Message);
const fs = require("fs");
fs.appendFile("latest.log", "\n" + json.Message);
fs.appendFile("latest.log", "\n" + json.Message, (err) => {
if (err) console.log("Callback error in appendFile:"+err);
});
}
} else {
console.log("Error: Invalid JSON received");