PHP code example of fiachehr / laravel-logger
1. Go to this page and download the library: Download fiachehr/laravel-logger library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fiachehr / laravel-logger example snippets
'observability' => [
'driver' => 'custom',
'via' => \Fiachehr\LaravelLogger\Logging\CreateLogger::class,
'level' => env('LOG_EXPLORER_LEVEL', 'debug'),
],
use Illuminate\Support\Facades\Log;
Log::info('Application ready', ['event' => 'application.ready', 'count' => 1]);
Log::warning('Checkout retry', ['event' => 'checkout.retry', 'count' => 2]);
Log::error('Checkout failed', ['event' => 'checkout.failed', 'exception' => $exception]);
use Fiachehr\LaravelLogger\Http\CorrelateRequest;
$middleware->web(prepend: [CorrelateRequest::class]);
$middleware->api(prepend: [CorrelateRequest::class]);
use App\Models\User;
use Illuminate\Support\Facades\Gate;
// Inside the provider's boot() method:
Gate::define('viewLogExplorer', fn (User $user): bool => (bool) $user->is_log_operator);
use function Fiachehr\LaravelLogger\log_dump;
log_dump($value, 'checkout.state'); // records a bounded type/count summary and continues
bash
php artisan vendor:publish --tag=log-explorer-config
dotenv
LOG_EXPLORER_ENABLED=true
LOG_EXPLORER_SERVICE=application
LOG_CHANNEL=observability
bash
php artisan log-explorer:password
bash
php artisan config:clear
php artisan route:clear
bash
php artisan log-explorer:serve --port=8765
bash
php artisan tinker --execute="Log::channel('observability')->info('Explorer ready', ['event' => 'application.ready']);"
php artisan log-explorer:doctor