PHP code example of gentenox / sentry-monolog-handler

1. Go to this page and download the library: Download gentenox/sentry-monolog-handler 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/ */

    

gentenox / sentry-monolog-handler example snippets


$logger->error('Cannot find existing order for user', [
    'user_id' => $user->getId()
]);

$logger->error('Invalid postback received', [
    MonologFields::Tags->value => ['scope' => 'postback_validation']
    MonologFields::Fingerprint->value => ['postback_validation_fingerprint']
]);
yaml
monolog_context_handler:
  class: SentryMonologHandler\MonologContextHandler
  arguments:
    $hub: '@Sentry\State\HubInterface'
    $level: !php/const Monolog\Logger::ERROR