{ } qjs-modules

console

Source: lib/console.js (pure JS) — default export: ConsoleSetup

A configurable console implementation built on the inspect pretty printer.

Exports

ExportArgsKindDescription
Console(...args)*functionConstructs a console object (log, info, warn, error, debug, …).
ConsoleOptions(obj)1functionBuilds/normalizes a console options object (formatting, depth, colors).
ConsoleSetup(inspectOptions, callback)2functionInstalls a global console; returns it. (default export)
inspect—re-exportRe-exported from the inspect module.

Streams

The constructor takes Node's forms; log, info and debug write to the first stream, error and warn to the second:

new Console(stdout, stderr, { inspectOptions });          // error, warn to stderr
new Console({ stdout, stderr, inspectOptions });          // the same
new Console(stream, { inspectOptions });                  // everything to stream (Node does the same)
new Console({ inspectOptions });                          // std.out, and std.err for error and warn

qjsm's global console is new Console(std.out, std.err, …), so console.error goes to stderr as in node, bun and deno.

Export list

Generated by utilities/doc-api.js from the console dump of utilities/api-surface.sh: 12 members. Edit the text above this block, not the block.

Functions: default(), inspect()

Console

class, constructible

  • methods: config(), time(), timeEnd(), timeLog()

ConsoleOptions

class, constructible

  • static methods: merge()
  • methods: merge()