Bun 提供了一个浏览器和 Node.js 兼容的 console
全局对象。此页面仅记录 Bun 原生 API。
对象检查深度
Bun 允许您配置console.log() 输出中嵌套对象的显示深度:
- CLI 标志: 使用
--console-depth <number>为单次运行设置深度 - 配置: 在
bunfig.toml中设置console.depth以进行持久配置 - 默认值: 对象检查深度为
2级别
从 stdin 读取
在 Bun 中,console 对象可以用作 AsyncIterable 来从 process.stdin 顺序读取行。
terminal