PHP code example of upaid / elk

1. Go to this page and download the library: Download upaid/elk 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/ */

    

upaid / elk example snippets


php artisan vendor:publish --provider="Upaid\Elk\Providers\ElkServiceProvider"



return [
    'mask' => [
        'replacement' => '[MASKED]',
        'fields' => [
            'password',
            'new_password',
            'password_confirmation',
            'card_no',
            'cvc',
        ],
        'patterns' => [
            '/^(?:4[0-9]{12}(?:[0-9]{3})?|[25][1-7][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/',
        ],
    ]
];
 php
'channels' => [
    'elk' => [
        'driver' => 'custom',
        'via' => \Upaid\Elk\Services\Logging\CreateCustomLogger::class,
        'log_name' => 'global'
    ],
    
    ...
 php
return [
    'default' => 'elk',
    
    ...
 php
Log::debug('An informational message.');
 php
use \Upaid\Elk\Services\Logging\Logger;

$logger = new Logger('testlog');
$logger->info('Hello World!');