PHP code example of code-distortion / clarity-logger

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

    

code-distortion / clarity-logger example snippets

 bash
php artisan vendor:publish --provider="CodeDistortion\ClarityLogger\ServiceProvider" --tag="config"
 php
// app/Exceptions/Handler.php

namespace App\Exceptions;

use CodeDistortion\ClarityLogger\Logger; // <<<
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
    …

    /**
     * Register the exception handling callbacks for the application.
     */
    public function register(): void
    {
        $this->reportable(function (Throwable $e) {

            Logger::log($e, $this->exceptionContext($e)); // <<<

        })->stop(); // <<<
    }
}
 php
Logger::channel('slack')->log($exception);