Question about util.debuglog(section) in Node.js?

  node.js, question

When learning Node.js, look at the official website document. In util module, the description of util.debuglog(section) is not very clear:
section: String The section of the program to be debugged
Returns: Function The logging function
This is used to create a function which conditionally writes to stderr based on the existence of a NODE_DEBUG environment variable. If the section name appears in that environment variable, then the returned function will be similar to console.error(). If not, then the returned function is a no-op.

  1. The questions are as follows:
    1) section specifically represents What?

2) The correct example is What? I don’t quite understand the example on the website:

var debuglog = util.debuglog('foo');
 var bar = 123;
 Debuglog ('hello fromfood [percentage d]', bar);

Among them, foo refers to the module, but I did not see any results after running (I defined the module foo myself)

Look at the source code

var debugs = {};
 var debugEnviron;
 exports.debuglog = function(set) {
 if (debugEnviron === undefined)
 debugEnviron = process.env.NODE_DEBUG || '';
 set = set.toUpperCase();
 if (!  debugs[set]) {
 If (new RegExp('\\b' plus set plus' \ \ b',' i'). test (debug environment)) {
 var pid =;
 debugs[set] = function() {
 var msg = exports.format.apply(exports, arguments);
 Error ('percentage s percentage d: percentage s', set, pid, msg);
 } else {
 debugs[set] = function() {};
 return debugs[set];