MCPcopy Index your code
hub / github.com/nodejs/node / debuglogImpl

Function debuglogImpl

lib/internal/util/debuglog.js:65–81  ·  view source on GitHub ↗
(enabled, set)

Source from the content-addressed store, hash-verified

63}
64
65function debuglogImpl(enabled, set) {
66 if (debugImpls[set] === undefined) {
67 if (enabled) {
68 const pid = process.pid;
69 emitWarningIfNeeded(set);
70 debugImpls[set] = function debug(...args) {
71 const colors = lazyUtilColors().shouldColorize(process.stderr);
72 const msg = formatWithOptions({ colors }, ...args);
73 const coloredPID = inspect(pid, { colors });
74 process.stderr.write(format('%s %s: %s\n', set, coloredPID, msg));
75 };
76 } else {
77 debugImpls[set] = noop;
78 }
79 }
80 return debugImpls[set];
81}
82
83// debuglogImpl depends on process.pid and process.env.NODE_DEBUG,
84// so it needs to be called lazily in top scopes of internal modules

Callers 1

debugFunction · 0.85

Calls 6

emitWarningIfNeededFunction · 0.85
lazyUtilColorsFunction · 0.70
formatWithOptionsFunction · 0.70
inspectFunction · 0.70
formatFunction · 0.70
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…