Skip to content

Commit

Permalink
Appropriate version. Reaplce console.log with debug
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmtracey committed Jan 20, 2018
1 parent deb0cfb commit 6af1cf3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
24 changes: 12 additions & 12 deletions index.js
Expand Up @@ -19,22 +19,22 @@ function executeMicrobitCommand(dataToPass, functionType = 'scrolling-text', tim
timeToDisplay
];

console.log(dataToPass);
debug(dataToPass);

console.log(arguments.join(' '));
debug(arguments.join(' '));

const microbitProcess = spawn('python', arguments);

microbitProcess.stdout.on('data', (data) => {
console.log(`node-red-contrib-bitio-string: stdout: ${data}`);
debug(`node-red-contrib-bitio-string: stdout: ${data}`);
});

microbitProcess.stderr.on('data', (data) => {
console.log(`node-red-contrib-bitio-string: stderr: ${data}`);
debug(`node-red-contrib-bitio-string: stderr: ${data}`);
});

microbitProcess.on('close', (code) => {
console.log(`node-red-contrib-bitio-string: child process exited with code ${code}`);
debug(`node-red-contrib-bitio-string: child process exited with code ${code}`);

if(code === 0){
resolve();
Expand All @@ -58,7 +58,7 @@ function runJob(node){
const dataToSend = isBitIoImage ? currentJob.payload.image : currentJob.payload.toString();
const jobType = isBitIoImage ? 'image' : 'scrolling-text';

console.log('jobType', jobType);
debug('jobType', jobType);

executeMicrobitCommand(dataToSend, jobType, currentJob.payload.displayFor)
.then(function(){
Expand All @@ -73,7 +73,7 @@ function runJob(node){

})
.catch(e => {
console.log('err:', e);
debug('err:', e);

processRunning = false;

Expand Down Expand Up @@ -101,9 +101,9 @@ module.exports = function(RED) {

node.on('input', function(msg) {

console.log('INPUT:', msg);
console.log(`There are ${jobs.length} that need to complete before this job is run.`);
console.log(`Adding job to queue`);
debug('INPUT:', msg);
debug(`There are ${jobs.length} that need to complete before this job is run.`);
debug(`Adding job to queue`);

jobs.push(msg);

Expand All @@ -127,7 +127,7 @@ module.exports = function(RED) {

node.on('input', function(msg) {

console.log('IMAGE-INPUT:', config);
debug('IMAGE-INPUT:', config);

msg.payload = {};
msg.payload.bitio_image = true;
Expand All @@ -149,7 +149,7 @@ module.exports = function(RED) {
const portNames = devices.map(device => device.comName);
res.send( JSON.stringify( { ports : portNames }) );
})
.catch(err => console.log('There was an error getting the serial ports on this system:', err))
.catch(err => debug('There was an error getting the serial ports on this system:', err))
;

});
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "node-red-contrib-bitio-wrapper",
"version": "2.0.1",
"version": "0.0.2",
"description": "",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 6af1cf3

Please sign in to comment.