diff --git a/lib/build-logger.js b/lib/build-logger.js index 286e804..f0d6700 100644 --- a/lib/build-logger.js +++ b/lib/build-logger.js @@ -8,6 +8,7 @@ export default class Logger extends EventEmitter { constructor (host, { debug = false, quiet = false } = {}) { super(); this.host = host; + this.debug = debug; this.quiet = quiet; // readyState @@ -84,10 +85,10 @@ export default class Logger extends EventEmitter { this.emit('close'); } - onSocketError () { - this.removeAllListeners(); - console.error('> Connection error'); - this.emit('error'); + onSocketError (err) { + if (this.debug) { + console.log('> [debug] Socket error', err.stack); + } } }