(enabled, set)
| 63 | } |
| 64 | |
| 65 | function 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 |
no test coverage detected
searching dependent graphs…