There are many Firebug extensions implementing new nifty features for Firebug and its great to see that new ones are still coming.

In this post, we'll take a quick look at one of them: Console Export.

ConsoleExport is a Firebug extension (you need Firebug 1.6+) that allows exporting logs from the Console panel. The export can be done manually through an Export button (see the screenshot below) or automatically by sending every log to the server.

ConsoleExport

Here is the UI that appears in Firebug after ConsoleExport is installed in your Firefox.

A few links:

ConsoleExport home page

You can download ConsoleExport from here

You can report an issue or suggest new feature here

Auto Export Every Console Log

Since most of the details about manual export is already available on the home page let's focus on auto-export where all logs are sent to the server as XML packets.

Step1: Activate auto-export

There are two ways how to activate/deactivate auto-export. You can use Firebug UI and click the little circle next to the Export button.

In case of automated scenarios (e.g. when Selenium is integrated) you can just set a preference (this is essentially what the button does).

extensions.firebug.consoleexport.active [boolean, default=false]

Step2: Handle XML packets on the server

Now you need to specify server URL where to send the logs (XML packets). This is done through another preference.

extensions.firebug.consoleexport.serverURL [string, default=""]

Here is an example server side script (PHP) that receives XML packets and stores them into consoleexport.log file.

<?php

$filename = 'consoleexport.log' ; if (!$handle = fopen($filename, 'a'))

{

echo 'File "'.$filename.'" could not be opened';

exit;

} ob_start();

$content = file_get_contents('php://input');

$content .= "

";

ob_clean(); if (!fwrite($handle, $content))

{

echo 'Can\'t write into file "'.$filename.'"';

exit;

} echo 'Done!';

fclose($handle);

?>

Here is an online page that generates some console logs (using console.* API)

And here is an example server side log:

<log >

<class > errorMessage </class >

<cat > assert </cat >

<msg > an assert </msg >

<href > http://legoas/consoleexport/tests/logs.html/event/seq/4/onclick </href >

<lineNo > 2 </lineNo >

<source >

onAssert()

</source >

</log >

<log >

<class > errorMessage </class >

<cat > js </cat >

<msg > ReferenceError: doesnotexist is not defined </msg >

<href > http://legoas/consoleexport/tests/logs.html </href >

<lineNo > 37 </lineNo >

</log >

You can also read detailed packet description.