PHP code example of lukam / logging-tap

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

    

lukam / logging-tap example snippets


'providers' => [	
	LoggingTap\LogServiceProvider::class
]

'log_tap' => [App\Taps\ExampleTap::class],



namespace App\Logging;
use Monolog\Processor\UidProcessor;

class PushProcessor
{
    public function __invoke($logger, $arguments)
    {
        $logger->getMonolog()->pushProcessor(new UidProcessor);
    }
}



namespace App\Logging;

use Monolog\Formatter\LineFormatter;

class Formatter
{
    public function __invoke($logger, $arguments)
    {
        $format = "[%datetime%] - [%level_name%]: %message% %context% %extra%\n";
        $formatter = new LineFormatter($format, null, true, true);

        foreach ($logger->getHandlers() as $handler) {
            $handler->setFormatter($formatter);
        }
    }

php artisan make:tap ExampleTap