From f9bf48f3e99a69f90af8252010440d3c603d0f97 Mon Sep 17 00:00:00 2001 From: zaphod1984 Date: Sun, 2 Jul 2017 16:30:46 +0200 Subject: [PATCH] introduce debug module, use debug module in DMXOutput --- lib/transport/DmxOutput.js | 5 ++++- package.json | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/transport/DmxOutput.js b/lib/transport/DmxOutput.js index daaaf90..3e50bf2 100644 --- a/lib/transport/DmxOutput.js +++ b/lib/transport/DmxOutput.js @@ -1,3 +1,5 @@ +import debug from 'debug'; + /** * Encapsulates the DMX-buffers to be used and handles sending of data to the * driver. @@ -17,6 +19,7 @@ export default class DmxOutput { this.frameCount = 0; this.frameInterval = 0; this.isRunning = false; + this.debug = debug('fivetwelve:dmxoutput'); this.dmxBuffers = []; this.dmxFrameCallbacks = []; @@ -143,7 +146,7 @@ export default class DmxOutput { } if (frameDuration > frameInterval) { - console.error(`skipped frame ${this.frameCount}`); + this.debug(`skipped frame ${this.frameCount}`) } // the `frameDuration % frameInterval` makes sure that a skipped frame diff --git a/package.json b/package.json index 5bbb5a1..eb6e35e 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "dependencies": { "array.from": "^0.2.0", "color-convert": "^0.6.0", + "debug": "^2.6.8", "object-assign": "^4.0.1", "parse-color": "^1.0.0" },