holyfalcon / logviewer
organized logs
Requires
- php: ^8.0
- monolog/monolog: ^3.0
- psr/log: ^2.0 || ^3.0
Requires (Dev)
- orchestra/testbench: ^6.23|^7.0|^8.0
- phpunit/phpunit: ^9.4
README
This package gives you a list of project logs. You can regularly check the log content with the time and level of that log in separate records.
Advantages of this package
Unlike other similar packages that read and display the records from the laravel.log file to check the project log, in this package, as soon as the log is created, before a record is saved in the file, it converts it to the appropriate format and the important parts of each record. For example: it extracts the content, level, date and channel of the record and stores it in the database. This makes the log list not dependent on the file, and if the size of the log file increases, the loading speed of the page related to the logs will not decrease.
Install package
Install via composer
composer require holyfalcon/logviewer
Add Service Provider to config/app.php
in providers
section
Falcon\Logviewer\LogviewerServiceProvider::class,
To get the log in real time we should define new channel in config/logging.php
inside channels
array below of stack
channel
'stack' => [ ... ], 'log-viewer' => [ 'driver' => 'custom', 'via' => \Falcon\Logviewer\Services\LogviewerService::class, 'level' => 'debug', ],
Add this log-viewer
in channels of stack
'stack' => [ 'driver' => 'stack', 'channels' => ['single', 'log-viewer'], 'ignore_exceptions' => false, ],
Migrate logs table for storing records:
php artisan migrate
Now you can publish the views by the artisan command:
php artisan vendor:publish --tag=views
That's it after this steps in /logs
you can see logs of your project.