PHP code example of smartness / laravel-logging
1. Go to this page and download the library: Download smartness/laravel-logging 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/ */
smartness / laravel-logging example snippets
'channels' => ['single', 'daily', 'stdout', 'stderr', 'payments'],
'stdout' => [
'driver' => 'monolog',
'handler' => \Monolog\Handler\StreamHandler::class,
'with' => ['stream' => 'php://stdout'],
'level' => env('LOG_LEVEL', 'debug'),
],
use Illuminate\Support\Facades\Log;
Log::info('Import completed', ['batch_id' => 123]);
Log::channel('payments')->warning('Payment retry scheduled', ['attempt' => 2]);
Log::error('Payment failed', ['exception' => $exception]);
Log::withContext(['tenant_id' => 456])->info('Import started');
'sensitive_fields' => ['business_secret', 'integration_credentials'],
'sensitive_fields_mode' => 'extend',
'stderr' => [
'driver' => 'monolog',
'handler' => \Monolog\Handler\StreamHandler::class,
'with' => ['stream' => 'php://stderr'],
'level' => env('LOG_LEVEL', 'info'),
],
shell
php artisan vendor:publish --tag=structured-logging-config
shell
php artisan octane:frankenphp --host=0.0.0.0 --log-level=warn