Downloads
Stars
Version
Laravel failsafe custom logging library
composer require imtigger/laravel-custom-log
On Laravel 5.4 and below, add the ServiceProvider to your config/app.php
Imtigger\LaravelCustomLog\LaravelCustomLogServiceProvider::class
Publish Config
php artisan vendor:publish --provider="Imtigger\\LaravelCustomLog\\LaravelCustomLogServiceProvider" --tag=config
Publish MySQL Migration (Optional, for Log to MySQL)
php artisan vendor:publish --provider="Imtigger\\LaravelCustomLog\\LaravelCustomLogServiceProvider" --tag=migration
Add config into .env
, you may enable multiple destinations
CustomLog::emergency($channel, $message, $context)
CustomLog::alert($channel, $message, $context)
CustomLog::critical($channel, $message, $context)
CustomLog::error($channel, $message, $context)
CustomLog::warning($channel, $message, $context)
CustomLog::notice($channel, $message, $context)
CustomLog::info($channel, $message, $context)
CustomLog::debug($channel, $message, $context)
CustomLog::log($level, $channel, $message, $context)
Edit your bootstrap/app.php
, add this before returning the application
$app->configureMonologUsing(function ($monolog) {
$monolog->pushHandler(Imtigger\LaravelCustomLog\CustomLog::getSystemHandler());
});
Edit your config/logging.php
, add this to the channels
array
'customlog' => [
'driver' => 'custom',
'via' => Imtigger\LaravelCustomLog\CustomLog::class,
]