Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pfrug/clear-logs
Laravel Packages: Comand to remove old logs from Laravel.
https://github.com/pfrug/clear-logs
composer laravel logs php
Last synced: 24 days ago
JSON representation
Laravel Packages: Comand to remove old logs from Laravel.
- Host: GitHub
- URL: https://github.com/pfrug/clear-logs
- Owner: pfrug
- License: mit
- Created: 2022-01-10T21:43:57.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-03-20T20:59:25.000Z (almost 2 years ago)
- Last Synced: 2024-11-18T15:49:14.041Z (3 months ago)
- Topics: composer, laravel, logs, php
- Language: PHP
- Homepage:
- Size: 80.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ClearLogs
Laravel comandCommand to remove old logs from Laravel. Supports "single" and "daily" channels
## Installation
``` sh
composer require pfrug/clear-logs
```Add the service provider in `config/app.php`
```php
'providers' => [
...
Pfrug\ClearLogs\ClearLogsServiceProvider::class,
];
```
Add the configuration file (optionally)
``` sh
php artisan vendor:publish --provider="Pfrug\ClearLogs\ClearLogsServiceProvider"
```
Optionally, you may also run php artisan vendor:publish --tag="clear-logs-config" to publish the configuration file in config/clearlogs.php## Usage
Execute artisan command:
``` sh
php artisan log:clear
```Or run as a schedule. Add this code in `app/Console/Kernel.php`
``` php
protected function schedule(Schedule $schedule)
{
$schedule->command('log:clear')->daily();
}
```## Configuration
Pblish configuration
```sh
php artisan vendor:publish --tag="clear-logs-config"
```This command create file configuration options to: `config/clearlogs.php`
```php
/*
* Number of days to preserve logs
* @var int
*/
'days' => 7,/**
* Indicates the criteria to evaluate the date of the log file to be deleted.
* it can be by date of modification or by name of the file ej:"laravel-2022-05-22.log"
* @var String mit|name
*/
'evalDateByNameOrMTime' => 'name',
```## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.