PHP code example of irap / exception-logger

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

    

irap / exception-logger example snippets


new \iRAP\ExceptionLogger\ExceptionLogger(
    $logger, // objec tof LoggerInterface
    "My Service", 
    $nextExcptionHandler=function(Throwable $e) { /*  do nothing */ }
);

/* @var $logger LoggerInterface */
$nextExcptionHandler = function(Throwable $e) { 
    // my custom uncaught exception handling goes here.
};

new \iRAP\ExceptionLogger\ExceptionLogger(
    $logger,
    "My Service", 
    nextExcptionHandler
);

$next = function(Throwable $e) { 
    restore_exception_handler();
    throw $e; //This triggers the previous exception handler
};

new \iRAP\ExceptionLogger\ExceptionLogger(
    $logger,
    "My Service", 
    $next
);