From 39834eacc0e709b70042d2d17f2ae4554d64d18a Mon Sep 17 00:00:00 2001 From: Basit <1305718+mabaasit@users.noreply.github.com> Date: Fri, 8 Jul 2022 10:34:13 +0200 Subject: [PATCH] http2: log debug only when in debug mode PR-URL: https://github.com/nodejs/node/pull/43626 Reviewed-By: Matteo Collina Reviewed-By: Anna Henningsen Reviewed-By: Rafael Gonzaga Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Ricky Zhou <0x19951125@gmail.com> --- lib/internal/http2/core.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 4b39384014c..520aacc8ff2 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)); }