make print-out of traffic easier to read

This commit is contained in:
Artem Titoulenko 2021-09-08 13:06:47 -04:00
parent 4880c42647
commit 7df7db98e5

View file

@ -11,9 +11,9 @@ class Communicator {
this.socket.on('data', (data) => { this.socket.on('data', (data) => {
console.log('DATA-----------------------'); console.log('DATA-----------------------');
console.log('RECV', logDataStream(Buffer.from(data, 'hex')));
const flap = FLAP.fromBuffer(Buffer.from(data, 'hex')); const flap = FLAP.fromBuffer(Buffer.from(data, 'hex'));
console.log('RECV', flap.toString()); console.log('RECV', flap.toString());
console.log('RAW\n' + logDataStream(Buffer.from(data, 'hex')));
this.handleMessage(flap); this.handleMessage(flap);
}); });
@ -47,7 +47,7 @@ class Communicator {
send(message) { send(message) {
console.log('SEND', message.toString()); console.log('SEND', message.toString());
console.log('SEND', logDataStream(message.toBuffer())); console.log('RAW\n' + logDataStream(message.toBuffer()));
console.log('-----------------------DATA'); console.log('-----------------------DATA');
this.socket.write(message.toBuffer()); this.socket.write(message.toBuffer());
} }