Skip to content

Commit 217bb0e

Browse files
cjihrigtargos
authored andcommitted
lib: simplify several debug() calls
Avoid calling Array.prototype.join() in debug() calls. These are evaluated on every call, even if the debug() call is a no-op. This commit replaces the join() calls with the %j placeholder. PR-URL: #25241 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent e6b5232 commit 217bb0e

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

‎lib/internal/http2/core.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,8 @@ function onOrigin(origins) {
477477
constsession=this[kOwner];
478478
if(session.destroyed)
479479
return;
480-
debug(`Http2Session ${sessionName(session[kType])}: origin received: `+
481-
`${origins.join(', ')}`);
480+
debug('Http2Session %s: origin received: %j',
481+
sessionName(session[kType]),origins);
482482
session[kUpdateTimer]();
483483
if(!session.encrypted||session.destroyed)
484484
returnundefined;

‎lib/internal/modules/esm/create_dynamic_module.js‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ const ArrayJoin = Function.call.bind(Array.prototype.join);
66
constArrayMap=Function.call.bind(Array.prototype.map);
77

88
constcreateDynamicModule=(exports,url='',evaluate)=>{
9-
debug(
10-
`creating ESM facade for ${url} with exports: ${ArrayJoin(exports,', ')}`
11-
);
9+
debug('creating ESM facade for %s with exports: %j',url,exports);
1210
constnames=ArrayMap(exports,(name)=>`${name}`);
1311

1412
constsource=`

0 commit comments

Comments
 (0)