<!DOCTYPE html> <body> <h2>Projects</h2> <h3>JavaScript Server-Side Console</h3> <div class="downloadBox"> <img src="/static/images/console.png" alt="" /> <p class="version">Version 0.0.4</p> <ul> <li><a href="/downloads/console.js">Download console.js</a></li> <li><a href="/downloads/Jaxer.console.js">Download Jaxer.console.js Jaxer Extension</a></li> <li><a href="http://github.com/smith/console/tree/master">Git Repository</a></li> </ul> </div> <p>This script partially implements the <a href="http://getfirebug.com/console.html">Firebug Console API</a> for server-side JavaScript using the <a href="http://www.wildfirehq.org/">Wildfire</a>/<a href="http://www.firephp.org/">FirePHP</a> protocol. It currently runs on <a href="http://aptana.com/jaxer">Aptana Jaxer</a> and <a href="http://www.w3schools.com/asp/default.asp">“Classic” ASP</a>, and <a href="http://appjet.com/">AppJet</a>, though support for other server-side JavaScript platforms is planned for future releases.</p> <h3>Requirements</h3> <h4>Server</h4> <ul> <li><a href="http://aptana.com/jaxer/download">Jaxer</a> 1.0 or newer</li> </ul> <p>or</p> <ul> <li>Microsoft IIS</li> <li><a href="/projects/prototype-asp">Prototype ASP</a> (for <a href="http://json.org">JSON</a> support.)</li> </ul> <p>or</p> <ul> <li>AppJet</li> </ul> <h4>Client</h4> <ul> <li><a href="http://getfirefox.com/">Mozilla Firefox</a></li> <li>The <a href="http://getfirebug.com/">Firebug</a> extension</li> <li>The <a href="http://firephp.org/">FirePHP</a> extension</li> </ul> <h3>Differences Between Firebug/FirePHP and This</h3> <p>The Firebug Console API lets you log multiple objects in one statement and use them with the string substition (i.e. <code>console.log("My object: %o", obj)</code>). 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 <code>"object"</code> to the <code>typeof</code> 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.</p> <p>These methods of the Firebug Console API are not currently implemented:</p> <ul> <li>console.assert()</li> <li>console.count()</li> <li>console.dir()</li> <li>console.dirxml()</li> <li>console.profile()</li> <li>console.profileEnd()</li> <li>console.trace()</li> </ul> <p>These features of FirePHP are not implemented:</p> <ul> <li>Dump</li> <li>Table</li> <li>Trace</li> </ul> <p>Some of these will be implemented in future releases, others will not.</p> <p>In addition, you can enable and disable messages from appearing with <code>console.enable()</code> and <code>console.disable()</code> respectively.</p> <h3>Usage</h3> <ol> <li><a href="/downloads/console.js">Download console.js</a> and put it where your web files are stored.</li> <li>Include it in a page: </ol> <h5>On ASP:</h5> <code class="prettyprint"> <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> </code> <h5>On Appjet:</h5> <p>The console library is hosted at <a href="http://lib-console.appjet.net/">http://lib-console.appjet.net/</a>. You can use it in your own AppJet applications by calling <code>import('lib-console');</code>.<p> <p>An example page is hosted at <a href="http://console-test.appjet.net/">http://console-test.appjet.net/</a>.</p> <h5>On Jaxer:</h5> <code class="prettyprint"> <script src="console.js" runat="server"></script> <script runat="server"> console.log("Hello world!"); console.info("And", "so", "on"); </script> </code> <h5>As a Jaxer Extension:</h5> <p><a href="/downloads/Jaxer.console.js">Download the Jaxer extension</a> and place it into your <code>local_jaxer/extensions</code> directory. Once Jaxer is restarted, the <code>Jaxer.console</code> object becomes available to all scripts. Usage is the same as above, except the script does not need to be included and <code>Jaxer.console</code> is used instead of <code>console</code>.</p> <p>Echoing to the Jaxer log can be enabled and disabled by setting <code>Jaxer.console.echo</code> to true and false respectively.</p> <p>These Boolean options can also be set in your <code>local_jaxer/conf/config.js</code>: <ul> <li><code>CONSOLE_DISABLED</code></li> <li><code>CONSOLE_ECHO_TO_LOG</code></li> </ul> <h4>History</h4> <h5>Version 0.0.4</h5> <h6>November 21, 2008</h6> <ul><li>Added AppJet support</li></ul> <h5>Version 0.0.3</h5> <h6>November 20, 2008</h6> <ul><li>Added Jaxer extension</li></ul> <h5>Version 0.0.2</h5> <h6>November 12, 2008</h6> <ul> <li>Added ASP support</li> <li>Added MIT License and change log</li> <li>Fixed Jaxer toJSON bug</li> <li>Minor code cleanup</li> </ul> <h5>Version 0.0.1</h5> <h6>November 9, 2008</h6> <ul> <li>Initial release</li> </ul> <h4>Known Issues</h4> <ul> <li>If too many messages are logged in a given request, the server will not respond at all. What “too many” is depends on your platform. If your server does not respond, don't log so many messages or disable the console object. This threshold is reasonably high on ASP, and there is <a href="http://support.aptana.com/asap/browse/JXR-400">a bug report</a> open for Jaxer.</li> <li>If you find any other problems or have any comments, please <a href="/contact/">contact me</a>.</li> </ul> <h4>Acknowledgements</h4> <p>This script would not have been possible without the help of these people:</p> <ul> <li>Christoph Dorn, for the FirePHP library</li> <li>Joe Hewitt, et. al. (did people make websites before Firebug?)</li> <li>The folks at <a href="http://webtoolkit.info">webtoolkit.info</a>, for their <code>sprintf</code> implementation</li> <li>Davey at Aptana, and the whole Aptana staff for all of their help with Jaxer and the T-shirt</li> </ul> <script runat="server" src="/site.js"></script> </body>