Skip to content

Laravel Log Cleaner is a simple package that allows you to clear the content of the laravel.log file using an Artisan command. This package is compatible with Laravel versions 8, 9, 10, and 11.

License

Notifications You must be signed in to change notification settings

jiordiviera/laravel-log-cleaner

Repository files navigation

██╗      █████╗ ██████╗  █████╗ ██╗   ██╗███████╗██╗     
██║     ██╔══██╗██╔══██╗██╔══██╗██║   ██║██╔════╝██║     
██║     ███████║██████╔╝███████║██║   ██║█████╗  ██║     
██║     ██╔══██║██╔══██╗██╔══██║╚██╗ ██╔╝██╔══╝  ██║     
███████╗██║  ██║██║  ██║██║  ██║ ╚████╔╝ ███████╗███████╗
╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝  ╚═══╝  ╚══════╝╚══════╝

██╗      ██████╗  ██████╗     
██║     ██╔═══██╗██╔════╝     
██║     ██║   ██║██║  ███╗    
██║     ██║   ██║██║   ██║    
███████╗╚██████╔╝╚██████╔╝    
╚══════╝ ╚═════╝  ╚═════╝     

 ██████╗██╗     ███████╗ █████╗ ███╗   ██╗███████╗██████╗ 
██╔════╝██║     ██╔════╝██╔══██╗████╗  ██║██╔════╝██╔══██╗
██║     ██║     █████╗  ███████║██╔██╗ ██║█████╗  ██████╔╝
██║     ██║     ██╔══╝  ██╔══██║██║╚██╗██║██╔══╝  ██╔══██╗
╚██████╗███████╗███████╗██║  ██║██║ ╚████║███████╗██║  ██║
 ╚═════╝╚══════╝╚══════╝╚═╝  ╚═╝╚═╝  ╚═══╝╚══════╝╚═╝  ╚═╝

Latest Stable Version Total Downloads Latest Unstable Version License Tests Status

Laravel Log Cleaner is a simple package that allows you to clear the content of the laravel.log file using an Artisan command. This package is compatible with Laravel versions 7, 8, 9, 10, and 11.

Installation

Install the package via Composer by running:

composer require jiordiviera/laravel-log-cleaner

Compatibility

  • Laravel 7.x
  • Laravel 8.x
  • Laravel 9.x
  • Laravel 10.x
  • Laravel 11.x

Usage

This package adds an Artisan command to clear the content of the laravel.log file. There are two ways to use this command:

  1. To clear all logs:
php artisan log:clear
  1. To clear logs older than a specified number of days:
php artisan log:clear --days=30

Replace 30 with the number of days you want to keep. This will remove all log entries older than the specified number of days.

Examples

Clear all logs:

$ php artisan log:clear
Log file cleared successfully.

Clear logs older than 30 days:

$ php artisan log:clear --days=30
Logs older than 30 days have been removed.

Configuration

No additional configuration is required. Once the package is installed, the log:clear command is ready to use.

Running Tests

This package uses Pest for testing. To run the tests, use:

./vendor/bin/pest

Ensure your tests are correctly defined in the tests/ directory.

Contributing

Contributions are welcome! Feel free to submit Issues or Pull Requests via GitHub.

Development Workflow

If you want to contribute:

  1. Clone the repository:

    git clone https://github.com/jiordiviera/laravel-log-cleaner.git
  2. Install dependencies:

    composer install
  3. Run tests:

    ./vendor/bin/pest

About

This package was developed to simplify log file management in Laravel projects. Instead of manually clearing the logs, you can now achieve it with a single command, with the option to selectively remove older logs.

License

The Laravel Log Cleaner package is open-source software licensed under the MIT License.


Note: Although this package was initially developed with Laravel 11, it is also compatible with earlier versions of Laravel (7, 8, 9, and 10).

For more information, visit the GitHub repository.

About

Laravel Log Cleaner is a simple package that allows you to clear the content of the laravel.log file using an Artisan command. This package is compatible with Laravel versions 8, 9, 10, and 11.

Resources

License

Security policy

Stars

Watchers

Forks

Languages