jiordiviera/laravel-log-cleaner

A Laravel package to easily clean the log files.

v1.0.3 2024-12-03 14:05 UTC

This package is auto-updated.

Last update: 2024-12-03 16:08:34 UTC


README

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

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

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

Latest Stable Version Total Downloads Latest Unstable Version License Tests Status

Laravel Log Cleaner is a utility package designed for the efficient management of Laravel log files. It allows developers to quickly clear log data using an Artisan command, enhancing application performance and management. This tool is compatible with Laravel versions 7, 8, 9, 10, and 11.

Installation

You can install the package via Composer by executing the following command:

composer require jiordiviera/laravel-log-cleaner

Compatibility

This package supports the following Laravel versions:

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

Usage

After installation, an Artisan command is available to clear the Laravel log file. You can use this command in two ways:

  1. To clear all logs:

    php artisan log:clear
  2. To clear logs older than a specific number of days:

    php artisan log:clear --days=30

    Replace 30 with desired days. This will delete all log entries older than the specified 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 necessary. The log:clear command is immediately available upon package installation.

Running Tests

This package uses Pest for testing. You can run tests with the following command:

./vendor/bin/pest

Ensure your tests are organized correctly within the tests/ directory.

Contributing

Contributions are welcomed! Feel free to submit Issues or Pull Requests on GitHub.

Development Workflow

For contributors:

  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 created to streamline the management of log files in Laravel applications. Instead of manually clearing the log files, you can achieve this efficiently with a single command, with the option to selectively remove older logs.

License

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

Note: Initially developed for Laravel 11, this package remains compatible with earlier versions (7, 8, 9, 10).

For further information, visit the GitHub repository.