Module: console

JavaScript module for outputting messages. This implementation is attempting to be compatible with the console module in Node.js, http://nodejs.org/api/console.html. It requires the util module.

Version:
  • $$Id$$
Author:
  • Edward A. Lee
Source:

Members

(static) info

Same as console.log.

Source:

Methods

(static) assert(assertion, args)

If the first argument is not "truthy", then throw an error that includes a (formatted) message given by the remaining arguments.

Parameters:
Name Type Description
assertion

The value being asserted to be true.

args

One or more additional arguments to form an error message if the assertion is false, where the first argument is optionally a formatting specification string.

Source:

(static) dir(object, options)

Apply util.inspect to the specified object (possibly with options) and then report as done by log(). The optional options argument is an object that may contain the following fields:

  • showHidden - if true then non-enumerable properties will be shown as well. Defaults to false.
  • depth - tells inspect how many times to recurse while formatting the object. Defaults to 2. Use null to get unbounded depth.
  • colors - if true, then the output will be styled with ANSI color codes. Defaults to false.
  • customInspect - if false, then custom inspect() functions defined on the objects being inspected won't be called. Defaults to true.

Parameters:
Name Type Description
object

Object to send to the log.

options

Options governing how the object is described.

Source:

(static) error(arguments)

Same as console.log, but prefix the message with "ERROR: ".

Parameters:
Name Type Description
arguments

One or more arguments to display in the log, where the first argument is optionally a formatting specification string.

Source:

(static) log(arguments)

Send a message to listeners of the JavaScript object. The first string can be a printf-style formatting string, followed by arguments to insert into the output, as for example:

    console.log('My count: %d', myCount);
 
If the first string does not contain any formatting elements, then util.inspect() is applied to all arguments.

Parameters:
Name Type Description
arguments

One or more arguments to display in the log, where the first argument is optionally a formatting specification string.

Source:

(static) time(label)

Record the current time using the specified label for use by a later call to timeEnd().

Parameters:
Name Type Description
label

The label for the time point.

Source:

(static) timeEnd(label)

Log the time elapsed since the last call to time() that gave the same label (using the log() function).

Parameters:
Name Type Description
label

The label for the starting time point.

Source:

(static) trace(arguments)

Send a stack trace to the actor listener window or to stderr (if debugging is off) prefixed by "TRACE: " and any supplied (formatted) message.

Parameters:
Name Type Description
arguments

One or more arguments to display in the log, where the first argument is optionally a formatting specification string.

Source:

(static) warn(arguments)

Same as console.log, but prefix the message with "WARNING: " and send to stderr (if debugging is off).

Parameters:
Name Type Description
arguments

One or more arguments to display in the log, where the first argument is optionally a formatting specification string.

Source: