PHP code example of befuturein / laravel-log-enhancer

1. Go to this page and download the library: Download befuturein/laravel-log-enhancer 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/ */

    

befuturein / laravel-log-enhancer example snippets


return [
    'enabled' => true,
    'correlation' => [
        'header' => 'X-Correlation-Id',
    ],
    'context' => [
        'confirmation', 'token'],
        'mask' => '***',
    ],
];

use BeFuture\LogEnhancer\Middleware\InjectLogContext;

protected $middleware = [
    // ...
    InjectLogContext::class,
];

protected $middlewareGroups = [
    'web' => [
        // ...
        \BeFuture\LogEnhancer\Middleware\InjectLogContext::class,
    ],
];

'channels' => [
    'stack' => [
        'driver' => 'stack',
        'channels' => ['single'],
        'tap' => [
            \BeFuture\LogEnhancer\Logging\ContextTap::class,
        ],
    ],
],

use Illuminate\Support\Facades\Log;
use BeFuture\LogEnhancer\Facades\LogEnhancer;

Log::info('User updated profile', LogEnhancer::context([
    'custom_note' => 'profile_update',
]));
bash
php artisan vendor:publish --provider="BeFuture\LogEnhancer\LogEnhancerServiceProvider" --tag="log-enhancer-config"