maxidev / tail-logger
Dynamic contextual logger for Laravel with Artisan tailing support
Requires
- php: ^8.1
- illuminate/support: ^11.0|^12.0
- monolog/monolog: ^3.0
This package is auto-updated.
Last update: 2025-05-17 20:29:52 UTC
README
Dynamic, contextual, and tailable logging package for Laravel.
Easily log messages into daily log files organized by custom folders, with full support for structured context data and a built-in Artisan command for colored tailingβeven on Windows.
π Features
β
Dynamic directory-based log storage
β
Daily rotating log files
β
Structured array/object context logging
β
Clean output format
β
Artisan command log:tail
for real-time log viewing
β
Colorized output by log level (info, warning, error, success)
β
Cross-platform tailing (Windows & Unix)
π¦ Installation
composer require maxidev/tail-logger
If installing from local or VCS:
composer config repositories.max-logger path ../path/to/package composer require maxidev/tail-logger:@dev
Laravel will auto-discover the service provider.
π§° Usage
π Log to a custom path with optional level and context
use Maxidev\Logger\TailLogger; // Basic log TailLogger::saveLog('User login successful', 'auth/login'); // With level TailLogger::saveLog('Invalid credentials', 'auth/login', 'warning'); // With context (array or object) TailLogger::saveLog('Payment processed', 'billing/invoices', 'success', [ 'user_id' => 123, 'amount' => 49.99, 'currency' => 'USD' ]);
π Log files are saved like:
storage/logs/auth/login/2025-05-17.log
storage/logs/billing/invoices/2025-05-17.log
π Real-time log tailing (with colors!)
php artisan log:tail auth/login php artisan log:tail billing/invoices --date=2025-05-15 php artisan log:tail api/events --live
β
Fully compatible with Windows and Linux
π¨ Colorized output: green = success, yellow = warning, red = error
βοΈ Customization
You can fully control:
- Path/folder structure
- Log level (
info
,warning
,error
,success
) - Context arrays
- Date formatting in logs
Internally based on Monolog v3 and Laravel's logging conventions.
π§ͺ Requirements
- PHP 8.1+
- Laravel 11 or 12
- Composer
π License
MIT Β© Max