PHP code example of pektiyaz / petalog-laravel

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

    

pektiyaz / petalog-laravel example snippets


 public function register(): void
    {
        $this->reportable(function (Throwable $e) {
            PetaLog::capture($e);
        });
    }

Copy code
use Pektiyaz\PetalogLaravel\PetaLogDriver\Facades\PetaLog;

// Capture an exception
try{
    //something happening
}catch (Exception $ex){
    PetaLog::capture($ex);
}

// Log custom data
PetaLog::log('Hello World', ['key' => 'value'], 'debug');
// Log to admin
PetaLog::admin('Hello World', 'resource');
PetaLog::admin('Hello World', 'resource', 'info');