Projects

JavaScript Server-Side Console

This script partially implements the Firebug Console API for server-side JavaScript using the Wildfire/FirePHP protocol. It currently runs on Aptana Jaxer and “Classic” ASP, and AppJet, though support for other server-side JavaScript platforms is planned for future releases.

Requirements

Server

or

or

Client

Differences Between Firebug/FirePHP and This

The Firebug Console API lets you log multiple objects in one statement and use them with the string substition (i.e. console.log("My object: %o", obj)). This implementation only lets you log a single object at a time. If the first argument to one of the functions is an object (that is, anything that responds with "object" to the typeof operator) it will be shown using FirePHP's Variable Viewer. If the list of arguments starts with a string or number, it will be logged as a text message.

These methods of the Firebug Console API are not currently implemented:

These features of FirePHP are not implemented:

Some of these will be implemented in future releases, others will not.

In addition, you can enable and disable messages from appearing with console.enable() and console.disable() respectively.

Usage

  1. Download console.js and put it where your web files are stored.
  2. Include it in a page:
On ASP:
<script src="prototype.js" language="JavaScript" runat="server"></script> <script src="console.js" language="JavaScript" runat="server"></script> <script language="JavaScript" runat="server"> console.log("Hello world!"); console.info("And", "so", "on"); </script>
On Appjet:

The console library is hosted at http://lib-console.appjet.net/. You can use it in your own AppJet applications by calling import('lib-console');.

An example page is hosted at http://console-test.appjet.net/.

On Jaxer:
<script src="console.js" runat="server"></script> <script runat="server"> console.log("Hello world!"); console.info("And", "so", "on"); </script>
As a Jaxer Extension:

Download the Jaxer extension and place it into your local_jaxer/extensions directory. Once Jaxer is restarted, the Jaxer.console object becomes available to all scripts. Usage is the same as above, except the script does not need to be included and Jaxer.console is used instead of console.

Echoing to the Jaxer log can be enabled and disabled by setting Jaxer.console.echo to true and false respectively.

These Boolean options can also be set in your local_jaxer/conf/config.js:

History

Version 0.0.4
November 21, 2008
Version 0.0.3
November 20, 2008
Version 0.0.2
November 12, 2008
Version 0.0.1
November 9, 2008

Known Issues

Acknowledgements

This script would not have been possible without the help of these people: