console.dir(obj[, options])


  • obj <any>

  • options <Object>

    • showHidden <boolean> 如果为 true,则对象的不可枚举和符号属性也将显示。默认值:false

      ¥showHidden <boolean> If true then the object's non-enumerable and symbol properties will be shown too. Default: false.

    • depth <number> 告诉 util.inspect() 在格式化对象时递归多少次。这对于检查大型复杂对象很有用。要使其无限递归,则传入 null。默认值:2

      ¥depth <number> Tells util.inspect() how many times to recurse while formatting the object. This is useful for inspecting large complicated objects. To make it recurse indefinitely, pass null. Default: 2.

    • colors <boolean> 如果为 true,则输出将使用 ANSI 颜色代码进行样式设置。颜色可定制;见 自定义 util.inspect() 颜色。默认值:false

      ¥colors <boolean> If true, then the output will be styled with ANSI color codes. Colors are customizable; see customizing util.inspect() colors. Default: false.

obj 上使用 util.inspect() 并将结果字符串打印到 stdout。此函数绕过在 obj 上定义的任何自定义 inspect() 函数。

¥Uses util.inspect() on obj and prints the resulting string to stdout. This function bypasses any custom inspect() function defined on obj.