console
Node-console-shaped logging for CLI tools and services. The full print family works; the one remaining print-path divergence is console.trace, which prints only its message with no stack walk. console.time tracks each label independently via a per-label backing map, matching console.count. console.table renders Node's exact Unicode box-drawing table for arrays of objects or primitives (other shapes fall back to console.log).
console.log(...)
Works, with caveatsWrites its arguments to stdout on one line, joined by single spaces, followed by a newline. A no-argument call prints a bare newline; objects and arrays are laid out as Node's util.inspect does — 80-column breaks, grouped columns, at most 100 array elements then `... n more items`, -0 shown as -0.
Returnsvoid — Nothing.
- A bare string is written via
printf's"%s", so a value with an embedded null byte truncates *on display* at the first\0— the stored string is intact, and inside an array/object it renders as'a\x00b'. Useprocess.stdout.writefor binary output
console.error(...)
ExactLike console.log, but writes to stderr instead of stdout.
Returnsvoid — Nothing.
console.warn(...)
ExactWrites to stderr, unprefixed — identical to console.error, exactly as real Node treats it.
Returnsvoid — Nothing.
console.info(...)
ExactAlias for console.log — writes to stdout on one line.
Returnsvoid — Nothing.
console.debug(...)
ExactAlias for console.log — writes to stdout on one line.
Returnsvoid — Nothing.
console.trace(...)
Works, with caveatsPrints "Trace: <message>" to stderr through the same generic print path as console.debug/info — with no stack-walking logic.
Returnsvoid — Nothing.
- Prints
"Trace: <message>"and nothing else; real Node's entire point of.trace()is the call stack it prints below the message, which this never generates at all
console.assert(cond, msg)
ExactWrites an assertion failure message when cond is falsy; does nothing when cond is truthy.
Parameters- condboolean
- The condition to test.
- msgstring
- Message printed on failure.
void — Nothing.
console.table()
Works, with caveatsRenders an array of objects (one column per shared field) or an array of primitives (a single Values column) as Node's Unicode box-drawing table — byte-for-byte the same layout Node v26 produces, with dynamic per-column widths, left-aligned cells, and quoted string cells.
- A
columnsfilter argument, a plain-object argument, and an array-of-arrays shape aren't tabulated — they fall back toconsole.log, as a non-tabular value does.
console.time() / .timeEnd()
supportedStarts a monotonic timer with time() and prints the elapsed "label: <N>ms" with timeEnd(). An omitted label is exactly "default", matching real Node. Distinct labels track independent timers via a per-label backing map.
Returnsvoid — Nothing.
console.time('work')
// ... work ...
console.timeEnd('work') // work: <N>msconsole.count() / .countReset()
Exactcount() prints "label: <n>" with a per-label counter that increments each call (the label converted to a string, as Node does); countReset() zeroes one label, and for a label with no count emits Node's process warning "Count for '<label>' does not exist". Backed by a real Map<string, number>.
Returnsvoid — Nothing.
console.count() // default: 1
console.count('apples') // apples: 1
console.countReset('apples')
console.count('apples') // apples: 1console.group() / .groupEnd()
ExactIndents every subsequent console.* line by two spaces per nesting level. group takes variadic label args formatted like console.log, and groupCollapsed is its terminal-identical alias. An unbalanced extra groupEnd() floors at depth 0 rather than going negative.
Returnsvoid — Nothing.
console.group('Section A')
console.log('inside A')
console.groupEnd()console.dir()
Works, with caveatsPrints a single value like a single-argument console.log, at Node's util.inspect default nesting depth of 2. The depth option overrides it (a number caps nesting, null is unlimited); beyond the cap a nested value shows as [Object]/[Array].
Returnsvoid — Nothing.
console.dir(obj, { depth: 0 }) // nested values as [Object]- The
colorsoption is accepted but ignored — inspected output carries no ANSI here.