Some logging cleanup.

This commit is contained in:
Evelyn Eastmond 2018-06-27 22:28:33 -04:00 committed by Ray Schamp
parent 387f03b08c
commit d79efbece8
3 changed files with 5 additions and 5 deletions

View file

@ -138,8 +138,7 @@ class BLESession extends JSONRPCWebSocket {
_sendError (e) { _sendError (e) {
this._connected = false; this._connected = false;
log.error(`BLESession error:`); log.error(`BLESession error: ${e}`);
log.error(e);
this._runtime.emit(this._runtime.constructor.PERIPHERAL_ERROR); this._runtime.emit(this._runtime.constructor.PERIPHERAL_ERROR);
} }
} }

View file

@ -10,6 +10,7 @@ class BTSession extends JSONRPCWebSocket {
* @param {Runtime} runtime - the Runtime for sending/receiving GUI update events. * @param {Runtime} runtime - the Runtime for sending/receiving GUI update events.
* @param {object} deviceOptions - the list of options for device discovery. * @param {object} deviceOptions - the list of options for device discovery.
* @param {object} connectCallback - a callback for connection. * @param {object} connectCallback - a callback for connection.
* @param {object} messageCallback - a callback for message sending.
*/ */
constructor (runtime, deviceOptions, connectCallback, messageCallback) { constructor (runtime, deviceOptions, connectCallback, messageCallback) {
const ws = new WebSocket(ScratchLinkWebSocket); const ws = new WebSocket(ScratchLinkWebSocket);
@ -107,8 +108,7 @@ class BTSession extends JSONRPCWebSocket {
} }
_sendError (e) { _sendError (e) {
log.error(`BLESession error:`); log.error(`BLESession error: ${e}`);
log.error(e);
this._runtime.emit(this._runtime.constructor.PERIPHERAL_ERROR); this._runtime.emit(this._runtime.constructor.PERIPHERAL_ERROR);
} }
} }

View file

@ -1,4 +1,5 @@
const JSONRPC = require('./jsonrpc'); const JSONRPC = require('./jsonrpc');
const log = require('../util/log');
class JSONRPCWebSocket extends JSONRPC { class JSONRPCWebSocket extends JSONRPC {
constructor (webSocket) { constructor (webSocket) {
@ -28,7 +29,7 @@ class JSONRPCWebSocket extends JSONRPC {
_onSocketMessage (e) { _onSocketMessage (e) {
const json = JSON.parse(e.data); const json = JSON.parse(e.data);
if (json.method !== 'characteristicDidChange') { if (json.method !== 'characteristicDidChange') {
console.log('received message: ' + JSON.stringify(json)); // log.info(`received message: ${json}`);
} }
this._handleMessage(json); this._handleMessage(json);
} }