teachiq / laravel-command-logger
Log commands with their execution time
Installs: 1 203
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 2
Open Issues: 0
Requires
- php: ^7.3|^8.0
- illuminate/support: ^8.0
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.0
- timacdonald/log-fake: ^1.7
README
We are no longer using this package in favor of https://github.com/spatie/laravel-schedule-monitor and Oh Dear (https://ohdear.app/).
Log commands with their execution time
Log the start and finish of all commands, along with their execution time. This is especially useful to detect if scheduled commands (for instance every night) run for longer than expected.
Installation
You can install the package via composer:
composer require teachiq/laravel-command-logger
Usage
The package auto-registers. The log is saved by default to storage/logs/command.log
.
[2020-06-07 10:30:14] environment.DEBUG: Starting route:list at 2020-06-07 10:30:14
[2020-06-07 10:30:14] environment.DEBUG: Finished route:list at 2020-06-07 10:30:14 (0.34346413612366 seconds)
[2020-06-07 10:36:25] environment.DEBUG: Starting exam:move-teacher at 2020-06-09 07:36:25
[2020-06-07 10:36:25] environment.DEBUG: __SLOW__ Finished exam:move-teacher at 2020-06-09 07:36:25 (18.763263940811 seconds)
You can configure the pagage by overriding the values in config/command-log.php
if you want. The default values are the following:
<?php return [ // The log channel where the logs are written 'channel' => [ 'driver' => 'single', 'path' => storage_path('logs/command.log'), 'level' => 'debug', ], // Specify any specific commands that should be excluded from logging 'exclude' => [ 'config:cache', 'route:cache', ], // Exeuctions longer than this value (in seconds) will be marked with __SLOW__ in the log 'slow' => 5, ];
Testing
composer test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email martin.krisell@gmail.com instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.