# Translation in progress # FireCake FireCake es una implementación del protocolo FirePHP para CakePHP. También provee una salida similar a la que se obtiene con los paneles de la barra de herramientas contenidas en DebugKit para peticiones que no sean HTML. Para utilizar FireCAke en peticiones HTML solo es necesario incluir ```App::import('Vendor', 'DebugKit.FireCake');``` en el código para cargar la clase. ## Getting setup In order to use FireCake you must be using [ FireFox](http://getfirefox.com) and have both [ Firebug](http://getfirebug.com) and [ FirePHP](http://firephp.org) installed. At this time FirePHP does not work with any other browsers. ## Using FireCake FireCake has a number of methods that are called statically. Unlike other FirePHP libraries, it is not necessary to get an instance of FireCake before using it. All the output from FireCake can be found in the console tab or the server sub tab for a request. FireCake cuenta con una cantidad de métodos que son invocados estáticamente. A diferencia de otras librerìas basadas en FirePHP, no es necesario obtener una instancia de FireCake para comenzar a utilizarlo. Todas la ### Logging Several logging levels are available including **info**, **log**, **warn** and **error**. These all function similarly but create different coloured messages in the Firebug console. The methods and signatures for these functions are FireCake::log($message, $label = null); Creates a log type message FireCake::info($message, $label = null); Creates an info message. FireCake::warn($message, $label = null); Creates a warning message. FireCake::error($message, $label = null); Creates and error message. All of the above messages will output to the *console* tab of Firebug ### firecake() In addition to the methods above FireCake creates a global function called ```firecake()```. It is simply a shortcut to ```FireCake::log()```, and as such takes the same arguments. ### Table based output FireCake also supports the generation of table output. Table output is created by ```FireCake::table($label, $message);``` The ```$message``` needs to be a multi-dimensional array, that represents rows and columns. $table[] = array('Col 1 Heading','Col 2 Heading'); $table[] = array('Row 1 Col 1','Row 1 Col 2'); $table[] = array('Row 2 Col 1','Row 2 Col 2'); $table[] = array('Row 3 Col 1','Row 3 Col 2'); FireCake::table('myTrace', $table); Would create output like: <table> <tr><th>Col 1 Heading </th><th>Col 2 Heading</th></tr> <tr><td>Row 1 Col 1</td><td>Row 1 Col 2</td></tr> <tr><td>Row 2 Col 1</td><td>Row 2 Col 2</td></tr> <tr><td>Row 3 Col 1</td><td>Row 3 Col 2</td></tr> </table> This can be found under the **console** tab of Firebug. ### Stack traces FireCake can also create stack traces. They are similar to those provided by Debugger::trace() but provide additional information on the arguments used when calling the methods in the trace. FireCake::trace($label); Will create a stack trace from the line of invocation. ### Dumping FireCake::dump($label, $message); Dumped variables will be found under the **server** sub tab for the specific request made, under the **net** tab in firebug. Dumped variables are click collapsible. ### Configuration Configuration of ```FireCake``` is done via ```FireCake::setOptions();``` There are a few configuration options. - **maxObjectDepth** The maximum depth objects should be converted to strings and encoded to JSON. Defaults to 10 - **maxArrayDepth** The maximum depth arrays should be converted to string and encoded to JSON. Defaults to 20 - **useNativeJsonEncode** Whether or not you want to use ```json_encode``` if it is available. Defaults to true. Recommended you use leave at true. - **includeLineNumbers** Whether or not you want call line numbers displayed when you hover over an outputted message. Defaults to true. Setting options is done by passing an array of the options you wish to change into ```FireCake::setOptions()``` FireCake::setOptions(array('includeLineNumbers' => false)); Would modify just the ```includeLineNumbers``` config setting. ### Disable FireCake output. There may be circumstances you need to disable FireCake's output without removing the calls to ```FireCake```. You can disable ```FireCake``` with ```FireCake::disable()```. Once disabled you can re-enable ```FireCake``` mid request with ```FireCake::enable()```.