API reference

console

12/12Coverage8/12Strict (zero caveats)

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).

Exact Works, with caveats Not supported

console.log(...)

Works, with caveats
log(...args: any[]): void

Writes 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.

Returns

void — Nothing.

⚠ Differences from standard
  • 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'. Use process.stdout.write for binary output

console.error(...)

Exact
error(...args: any[]): void

Like console.log, but writes to stderr instead of stdout.

Returns

void — Nothing.

console.warn(...)

Exact
warn(...args: any[]): void

Writes to stderr, unprefixed — identical to console.error, exactly as real Node treats it.

Returns

void — Nothing.

console.info(...)

Exact
info(...args: any[]): void

Alias for console.log — writes to stdout on one line.

Returns

void — Nothing.

console.debug(...)

Exact
debug(...args: any[]): void

Alias for console.log — writes to stdout on one line.

Returns

void — Nothing.

console.trace(...)

Works, with caveats
trace(...args: any[]): void

Prints "Trace: <message>" to stderr through the same generic print path as console.debug/info — with no stack-walking logic.

Returns

void — Nothing.

⚠ Differences from standard
  • 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)

Exact
assert(cond: boolean, msg?: string): void

Writes 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.
Returns

void — Nothing.

console.table()

Works, with caveats
table(data: object[] | primitive[]): void

Renders 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.

⚠ Differences from standard
  • A columns filter argument, a plain-object argument, and an array-of-arrays shape aren't tabulated — they fall back to console.log, as a non-tabular value does.

console.time() / .timeEnd()

supported
time(label?: string): void; timeEnd(label?: string): void

Starts 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.

Returns

void — Nothing.

console.time('work')
// ... work ...
console.timeEnd('work')   // work: <N>ms
See it in a full example →

console.count() / .countReset()

Exact
count(label?: string): void; countReset(label?: string): void

count() 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>.

Returns

void — Nothing.

console.count()            // default: 1
console.count('apples')    // apples: 1
console.countReset('apples')
console.count('apples')    // apples: 1
See it in a full example →

console.group() / .groupEnd()

Exact
group(...label: any[]): void; groupCollapsed(...label: any[]): void; groupEnd(): void

Indents 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.

Returns

void — Nothing.

console.group('Section A')
console.log('inside A')
console.groupEnd()
See it in a full example →

console.dir()

Works, with caveats
dir(value: any, options?: { depth?: number | null; colors?: boolean }): void

Prints 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].

Returns

void — Nothing.

console.dir(obj, { depth: 0 })  // nested values as [Object]
See it in a full example →
⚠ Differences from standard
  • The colors option is accepted but ignored — inspected output carries no ANSI here.