#Laravel LiveLogger
Simple way to display live logs on a custom dashboard., (*1)
The idea behind this was to have a TV on the office wall to display the data. And in a future release to send out a sound if there is a error or similar., (*2)
This app uses Pusher.com to send the data. There will be a Websocket version also but since Pusher's free account allows up to 100k messages a day im not sure anybody is going to use it., (*3)
Composer
"require": {
"igormatkovic/laravel-livelogger": "~1.0"
}
Setup
In app/config/app.php, (*4)
Comment the Laravel Log Service provider, (*5)
//'Illuminate\Log\LogServiceProvider',
And add this one:, (*6)
'Igormatkovic\Livelogger\LiveloggerServiceProvider',
Also change the Log alias:, (*7)
From:, (*8)
'Log' => 'Illuminate\Support\Facades\Log',
To:, (*9)
'Log' => 'Igormatkovic\Livelogger\Facades\Livelogger'
From the command line publish and edit the config:, (*10)
php artisan config:publish igormatkovic/laravel-livelogger
And insert your app data from Pusher.com, (*11)
return array(
'log_level' => (getenv('log_level') ?: 'error'),
'dateformat' => (getenv('dateformat') ?: 'H:i:s'),
'channel_name' => (getenv('channel_name') ?: 'livelogger'),
'pusher_app_id' => (getenv('pusher_app_id') ?: 'pusher_app_id'),
'pusher_api_key' => (getenv('pusher_api_key') ?: 'pusher_api_key'),
'pusher_api_secret' => (getenv('pusher_api_secret') ?: 'pusher_api_secret'),
'pusher_use_ssl' => (getenv('pusher_use_ssl') ?: false),
);
Or you can just insert the data in your .env.php to keep it out of GIT, (*12)
Once you have added your data, just generate the livelogger dash html, (*13)
php artisan livelogger:generate
Then just open your $domain.com/livelogger.html to see whats getting logged, (*14)
I would recommend using that URL as a iframe so you can put it in your custom dashboard., (*15)
But you can just integrate it directly into your own view:, (*16)
Don't forget to set your chanel_name and pusher_api_key, (*17)
Keep in mind. The more log pushes you have the slower the site is going to be!, (*18)
This app is for more critical parts of the app., (*19)
TO DO
- Unit tests.
- Sound for critical events.
- Secure the URL with a token or something.
- Design a better output interface, this one sucks.