bare-console
Reference for bare-console: a WHATWG console implementation for Bare—logging, timers, counters, assertions, and tables.
stable
bare-console is a WHATWG console implementation for Bare—the console.* API. The global console in a Bare program is an instance of it; you can also construct your own bound to a custom log function. It's pure JavaScript.
npm i bare-consoleUsage
const Console = require('bare-console')
const console = new Console()
console.log('Hello')
console.error(new Error('Something happened'))API
const console = new Console([log])
Create a console, optionally backed by a custom log function.
Methods
- Logging:
log(...data),info(...data),debug(...data),warn(...data),error(...data),trace(...data),clear(). - Timers:
time([label]),timeLog([label[, ...data]]),timeEnd([label]). - Counters:
count([label]),countReset([label]). - Other:
assert(condition, ...data),table(tabularData[, properties]).
Related modules
Builds on bare-format, bare-hrtime, bare-logger, bare-system-logger, and bare-type (see Bare modules).
See also
- Bare modules—the full
bare-*catalog. bare-inspector—deeper debugging via the V8 inspector.- Bare runtime API—the runtime this runs on.