Skip to content

Latest commit

 

History

History
56 lines (36 loc) · 1.49 KB

README.md

File metadata and controls

56 lines (36 loc) · 1.49 KB

Display Laravel logs on browser console (Chrome/Firefox)

[Screenshot]

Getting Started

1. Install browser plugin


2. Add PHP class

  • Copy log2browser.php into /vendor/cbmono/laravel-log2browser/

3. Init class and define used browser

  • Add this code into /app/start/local/.php
require_once base_path() . '/vendor/cbmono/laravel-log2browser/log2browser.php';

$myBrowser = 'chrome';              # Or 'fire' for Firefox
Log2Browser::init( $myBrowser );

4. Start logging from everywhere

# Example:
$testData = array('var1' => 'Hello world!', 'var2' => array('foo' => 'bar'));

Log2Browser::error('Error', $testData);

# Or use the shortcut
LogB::log('Error', $testData);

Note: I'm using Laravel Environment Configuration and restricting this functionality only to my local machine.


Options

/vendor/cbmono/laravel-log2browser/log2browser.php is just extending the default Laravel Log function. Therefor, you still have all the main functionalities including those from Monolog:

# Example:
LogB::info('This is some useful information.');

LogB::warning('Something could be going wrong.');

LogB::error('Something is really going wrong.');