mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-25 07:22:33 -05:00
Some logging cleanup.
This commit is contained in:
parent
387f03b08c
commit
d79efbece8
3 changed files with 5 additions and 5 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue