diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 7934675bea79c1..737c4c3b357360 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -190,10 +190,10 @@ let debug = require('internal/util/debuglog').debuglog('http2', (fn) => { debug = fn; }); -// TODO(addaleax): See if this can be made more efficient by figuring out -// whether debugging is enabled before we perform any further steps. Currently, -// this seems pretty fast, though. function debugStream(id, sessionType, message, ...args) { + if (!debug.enabled) { + return; + } debug('Http2Stream %s [Http2Session %s]: ' + message, id, sessionName(sessionType), ...new SafeArrayIterator(args)); }