Skip to content

Commit ec90cef

Browse files
cjihrigMylesBorins
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 b7095ba commit ec90cef

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

lib/internal/http2/core.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,8 @@ function onOrigin(origins) {
470470
const session = this[kOwner];
471471
if (session.destroyed)
472472
return;
473-
debug(`Http2Session ${sessionName(session[kType])}: origin received: ` +
474-
`${origins.join(', ')}`);
473+
debug('Http2Session %s: origin received: %j',
474+
sessionName(session[kType]), origins);
475475
session[kUpdateTimer]();
476476
if (!session.encrypted || session.destroyed)
477477
return undefined;

lib/internal/modules/esm/create_dynamic_module.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ const ArrayJoin = Function.call.bind(Array.prototype.join);
66
const ArrayMap = Function.call.bind(Array.prototype.map);
77

88
const createDynamicModule = (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
const names = ArrayMap(exports, (name) => `${name}`);
1311

1412
const source = `

0 commit comments

Comments
 (0)