ycanga / central-logger
Centralized logging package for Laravel
v1.1.1
2025-04-06 14:29 UTC
Requires
- php: ^8.0
- illuminate/support: ^11.0|^10.0|^9.0
README
A simple Laravel logging driver that sends logs to a central server.
🚀 Installation
- Install the package via Composer
composer require ycanga/central-logger
- Publish the configuration file
php artisan vendor:publish --provider="ycanga\CentralLogger\CentralLoggerServiceProvider" --tag="config"
⚙️ Configuration
- Add the following environment variables to your .env file:
LOG_CHANNEL=central_logger LOG_ENDPOINT=[YOUR-CENTRAL-LOGGER-SERVER-ENDPOINT]/api/log LOG_API_KEY=[YOUR-PROJECT-API-KEY]
- Register the logging channel in config/logging.php:
'channels' => [ // Other channels... 'central_logger' => [ 'driver' => 'central_logger', ], ],
📤 Usage
Once configured, Laravel will send all log messages to your central logger server via the central_logger channel.
You can also log manually using the channel:
Log::channel('central_logger')->info('This is a test log from my project.');