PHP code example of understand / understand-monolog
1. Go to this page and download the library: Download understand/understand-monolog 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/ */
understand / understand-monolog example snippets
use Monolog\Logger;
// input token from Understand.io
$inputToken = 'ab1cd234-1234-45e6-789f-gh1fa1234567';
// choose a handler, either async or sync (see below)
$understandAsyncHandler = new UnderstandMonolog\Handler\UnderstandAsyncHandler($inputToken); // async handler
$understandSyncHandler = new UnderstandMonolog\Handler\UnderstandSyncHandler($inputToken); // sync handler
$monologLogger = new Logger('name');
$monologLogger->pushHandler($understandAsyncHandler); // or $understandSyncHandler
$monologLogger->addError('first error');