demo/repl.js
function setDebugLevel(level, printf) {
  var outLevel = 0;

  debug = debug2 = debug3 = debugTree = function() {};

  switch (String(level)) {
    case '3':
      debug3 = printf;
      outLevel++;
      // fall through
    case '2':
      debugTree = function (fmt, tree) {
        printf(fmt, util.inspect(tree.toJSON(), false, 64));
      };
      debug2 = printf;
      outLevel++;
      // fall through
    case '1':
      debug = printf;
      outLevel++;
      // fall through
    default:
      return outLevel;
  }
}
function setDebugLevel(level, printf) {
  var outLevel = 0;

  debug = debug2 = debug3 = debugTree = function() {};

  switch (String(level)) {
    case '3':
      debug3 = printf;
      outLevel++;
      // fall through
    case '2':
      debugTree = function (fmt, tree) {
        printf(fmt, util.inspect(tree.toJSON(), false, 64));
      };
      debug2 = printf;
      outLevel++;
      // fall through
    case '1':
      debug = printf;
      outLevel++;
      // fall through
    default:
      return outLevel;
  }
}
function setDebugLevel ( level , printf ) { var outLevel = 0 ; debug = debug2 = debug3 = debugTree = function ( ) { } ; switch ( String ( level ) ) { case '3' : debug3 = printf ; outLevel ++ ; // fall through case '2' : debugTree = function ( fmt , tree ) { printf ( fmt , util . inspect ( tree . toJSON ( ) , false , 64 ) ) ; } ; debug2 = printf ; outLevel ++ ; // fall through case '1' : debug = printf ; outLevel ++ ; // fall through default : return outLevel ; } }
Selectively enables and disables the debug functions.
@param {number|string} level The debug level to set (0-3).
@param {function} printf The printf-style function to use.
@return {number} The level that was set.
Selectively enables and disables the debug functions .