diff --git a/.gitignore b/.gitignore index c311e8f..828a4cc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ launchConfigurations/ local-* /node_modules +/npm-debug.log +/mqtt.log diff --git a/app.js b/app.js index 7bb5a38..f08c88a 100644 --- a/app.js +++ b/app.js @@ -81,8 +81,8 @@ mqttServe.on('clientConnected', function(client) { mqttServe.on('published', function(packet, client){ console.log('Message: ', packet.payload.toString("utf8")); - - fs.appendFile("../logs/mqtt.log", packet.topic + ": " + packet.payload.toString("utf8") + "\n", function(err) { + var logfile = appEnv.isLocal ? "mqtt.log" : "../logs/mqtt.log"; + fs.appendFile(logfile, packet.topic + ": " + packet.payload.toString("utf8") + "\n", function(err) { if(err) { return console.log(err); }