Bun provides a browser- and Node.js-compatible
console global. This page only
documents Bun-native APIs.
Object inspection depth
Bun allows you to configure how deeply nested objects are displayed inconsole.log()
output:
- CLI flag: Use
--console-depth <number>
to set the depth for a single run - Configuration: Set
console.depth
in yourbunfig.toml
for persistent configuration - Default: Objects are inspected to a depth of
2
levels
Reading from stdin
In Bun, theconsole
object can be used as an AsyncIterable
to sequentially read lines from process.stdin
.
terminal