From 0860b11655c57597e36b8766157a5188d2e7ca22 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Wed, 8 Jul 2020 09:56:21 -0700 Subject: [PATCH] quic: proper custom inspect for QuicSession PR-URL: https://github.com/nodejs/node/pull/34247 Reviewed-By: Anna Henningsen --- lib/internal/quic/core.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/internal/quic/core.js b/lib/internal/quic/core.js index 2c3ab4b888ef41..f23894b7ec60ab 100644 --- a/lib/internal/quic/core.js +++ b/lib/internal/quic/core.js @@ -1777,10 +1777,9 @@ class QuicSession extends EventEmitter { stream[kStreamReset](code); } - [kInspect]() { - // TODO(@jasnell): A proper custom inspect implementation + [kInspect](depth, options) { const state = this[kInternalState]; - const obj = { + return customInspect(this, { alpn: state.alpn, cipher: this.cipher, closing: this.closing, @@ -1790,12 +1789,7 @@ class QuicSession extends EventEmitter { maxStreams: this.maxStreams, servername: this.servername, streams: state.streams.size, - stats: { - handshakeAck: this.handshakeAckHistogram, - handshakeContinuation: this.handshakeContinuationHistogram, - } - }; - return `${this.constructor.name} ${util.format(obj)}`; + }, depth, options); } [kSetSocket](socket) {