Module console

This module provides a familiar console object for logging and debugging defined in CommonJS Console/A

Functions


assert (expression, msg...)

Tests that an expression is true and throws an exception if not.

Parameters

expression the expression to test
... msg... one or more error messages

dir (obj)

Prints a list of all properties of an object.

Parameters

Object obj the object

error (msg...)

Logs a message with the visual "error" representation, including the file name and line number of the calling code.

Parameters

msg... one or more message arguments

info (msg...)

Logs a message with the visual "info" representation, including the file name and line number of the calling code.

Parameters

... msg... one or more message arguments

log (msg...)

Logs a message to the console.

The first argument to log may be a string containing printf-like placeholders. Otherwise, multipel arguments will be concatenated separated by spaces.

Parameters

msg... one or more message arguments

time (name)

Creates a new timer under the given name. Call console.timeEnd(name) with the same name to stop the timer and log the time elapsed.

Parameters

String name the timer name

timeEnd (name)

Stops a timer created by a call to console.time(name) and logs the time elapsed.

Parameters

String name the timer name

trace (msg...)

Prints a stack trace of JavaScript execution at the point where it is called.

Parameters

... msg... optional message arguments

warn (msg...)

Logs a message with the visual "warn" representation, including the file name and line number of the calling code.

Parameters

msg... one or more message arguments