Console API

Overview

Answer Generators implemented in Javascript or a content template have access to the Console API which allows you output log messages useful for post-mortum debugging. In the future, we'll be making the the Console API available to all plugins.

Specification

The Console API is modeled after the Firebug Console API, but only implements a subset of the methods:

  • log
  • trace
  • debug
  • info
  • warn
  • error
  • assert
  • clear
  • dir

Also, methods in the Firebug specification that take multiple argument objects only take a single argument in Solve for All's implementation. The argument object must be a string except in the case of dir(), in which case the argument is converted to JSON.

Usage

Just use the Console API just like you would in a browser. The console variable is available in the top-level scope, so you can write:

console.warn('Oh no! Something happened!');

Activation

To view the logs produced by the console, add whitespace then --debug to the end of a query. After submitting the query, you should see separate inline results containing log message for each Answer Generator that you developed and that was activated .

Security Considerations

A user of an Answer Generator doesn't have access to the console output unless he is the developer of the Answer Generator, so feel free to log sensitive information.

Limitations

To protect the security and performance of the answer service, the output of the Console API is limited to 10 KB.