Console

Console object is used to write messages to the default logging output. It has several log levels INFO, WARNING, ERROR, TRACE.

Version 3.x

Basic Usage

1
2
3
4
5
6
console.info("Info message: %s", "Hello World!");
console.error("Error message.");
console.warn("Warning message.");
console.debug("Debug message.");
console.log("Log message.");
console.trace("Trace.");

Definition


Functions


Function Description Returns
info(message, parameters) Logs a message with level INFO with formatting * -
error(message, parameters) Logs a message with level ERROR with formatting * -
warn(message, parameters) Logs a message with level WARN with formatting * -
debug(message, parameters) Logs a message with level DEBUG with formatting * -
log(message) Logs a raw message with level INFO -
trace(message, parameters) Logs a message with level ERROR with the full stack trace -
  • Formatting support is based on the standard Java Formatter

Compatibility


Rhino Nashorn V8
βœ… βœ… βœ…


Version 2.x

  • Module: built-in
  • Definition: /core_api/issues/2
  • Source: provided by the core
  • Status: beta

Basic Usage


1
2
3
4
5
6
console.info("Info message: %s", "Hello World!");
console.error("Error message.");
console.warn("Warning message.");
console.debug("Debug message.");
console.log("Log message.");
console.trace("Trace.");

Definition


Functions


Function Description Returns
info(message, parameters) Logs a message with level INFO -
error(message, parameters) Logs a message with level ERROR -
warn(message, parameters) Logs a message with level WARN -
debug(message, parameters) Logs a message with level DEBUG -
log(message, parameters) Logs a message with level INFO -
trace(message, parameters) Logs a message with level ERROR with the full stack trace -

Compatibility


Rhino Nashorn V8
βœ… βœ… ❌
Edit