Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hedii/artisan-log-cleaner
An artisan command to clear laravel log files
https://github.com/hedii/artisan-log-cleaner
artisan-command cleaner laravel log
Last synced: 13 days ago
JSON representation
An artisan command to clear laravel log files
- Host: GitHub
- URL: https://github.com/hedii/artisan-log-cleaner
- Owner: hedii
- License: mit
- Created: 2016-09-08T14:54:45.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-03-22T07:26:21.000Z (8 months ago)
- Last Synced: 2024-04-24T22:43:00.399Z (7 months ago)
- Topics: artisan-command, cleaner, laravel, log
- Language: PHP
- Size: 19.5 KB
- Stars: 40
- Watchers: 1
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[![Build Status](https://github.com/hedii/artisan-log-cleaner/workflows/Tests/badge.svg)](https://github.com/hedii/artisan-log-cleaner/actions)
[![Total Downloads](https://poser.pugx.org/hedii/artisan-log-cleaner/downloads)](//packagist.org/packages/hedii/artisan-log-cleaner)
[![License](https://poser.pugx.org/hedii/artisan-log-cleaner/license)](//packagist.org/packages/hedii/artisan-log-cleaner)
[![Latest Stable Version](https://poser.pugx.org/hedii/artisan-log-cleaner/v)](//packagist.org/packages/hedii/artisan-log-cleaner)# Artisan Log Cleaner
An artisan command to clear laravel log files
## Table of contents
- [Table of contents](#table-of-contents)
- [Installation](#installation)
- [Usage](#usage)
- [Clear all log files](#clear-all-log-files)
- [Clear all log files except the last one](#clear-all-log-files-except-the-last-one)
- [Testing](#testing)
- [License](#license)## Installation
Install via [composer](https://getcomposer.org/doc/00-intro.md)
```sh
composer require hedii/artisan-log-cleaner
```Add it to your providers array in `config/app.php`:
```php
Hedii\ArtisanLogCleaner\ArtisanLogCleanerServiceProvider::class
```## Usage
### Clear all log files
Run this command to clear all log files in the log directory (`storage/logs`):
```
php artisan log:clear
```### Clear all log files except the last one
Run this command to clear all log files except the last one in the log directory (`storage/logs`):
```
php artisan log:clear --keep-last
```### Clear all log files except specified file names
Run this command to clear all log files except the specified files in the option. Specify file name without extension. Can be combined with `--keep-last` option.
```
php artisan log:clear --keep="keptLog"
```### Automated cleanup of log files
Add this to the App\Console\Kernel schedule method to ensure daily cleanup of old log files
```
$schedule->command('log:clear --keep-last')->daily();
```## Testing
```
composer test
```## License
hedii/artisan-log-cleaner is released under the MIT Licence. See the bundled [LICENSE](https://github.com/hedii/artisan-log-cleaner/blob/master/LICENSE.md) file for details.