Fork me on GitHub
logo

ChromePHP

Console logging extension for Google Chrome

Installation

  1. Download and install the extension from the Google Chrome Extension Gallery.
  2. Click the extension icon to enable logging for the current tab's domain

    click on the icon
  3. Download the ChromePhp class for logging and put it somewhere in your include path.

  4. Start Logging:
    include 'ChromePhp.php'; ChromePhp::log('hello world'); ChromePhp::log($_SERVER); // using labels foreach ($_SERVER as $key => $value) { ChromePhp::log($key, $value); } // warnings and errors ChromePhp::warn('this is a warning'); ChromePhp::error('this is an error');

    Make sure you only include this in a development environment. You don't want users seeing your debug statements on production.

  5. If all is working correctly then your output will look something like this:

    screenshot

    Logging objects is also now supported:

    objects

    and warnings and errors:

    warnings

Change Log

version 3.0
adds support for chrome web request api in Chrome 17
version 2.2.3
adds new method to set multiple settings
adds console.info support
version 2.2.2
fixes issue with groupEnd
version 2.2.1
adds group logging support
version 2.2
fixes double encoding server side
fixes cookie size calculation server side
version 2.1.1
server side library no longer fails when trying to log private or protected properties in php < 5.3.
version 2.1.0.6
no longer using window.onload since this interferes with onload events on some pages.
version 2.1.0.5
fixes bug where sometimes the json file is cached by Chrome when requested via XMLHttpRequest.
version 2.1.0
adds actual support for ajax requests when using Chrome 6 or later
completely re-factored all the javascript used by the extension.
version 2.0.1
adds support for logging errors and warnings
big skip in versions is because of a bug in chrome: issue #54355
version 0.1475
fixes encoding issues with newline characters
version 0.147
adds support for new json data format
version 0.146
adds experimental support for setting a custom log directory server side where javascript can make requests to in order to get around the 4kb size limitation

see: http://www.chromephp.com/#file_storage for more information.

version 0.145
adds ability to toggle on and off extension by clicking on the icon. it defaults to being disabled.
remembers your setting based on the top level domain.

this means if you enable the extension on www.mywebsite.com then it will automatically be enabled in any tabs pointing to any site at *.mywebsite.com.

version 0.140
initial support for ajax requests (currently only for links, and form submits)
version 0.132
updates url to chromephp.com
version 0.131
fixes bug where logging in a loop would show the same file and line number multiple times
version 0.13
adds support for labels and filename/line numbers
adds options page to toggle on and off line numbers (right click on icon)
version 0.1
initial release

Support

If you are having trouble getting the extension working or have discovered a bug send me an email at chromephp@gmail.com.