PHP code example of itrukhin / bxmonolog

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

    

itrukhin / bxmonolog example snippets


'exception_handling' => 
  array (
    'value' => 
    array (
      'debug' => ((bool) $_ENV['APP_DEBUG']),
      'handled_errors_types' => E_ALL & ~E_WARNING & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE & ~E_DEPRECATED,
      'exception_errors_types' => E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_USER_WARNING & ~E_USER_NOTICE & ~E_COMPILE_WARNING & ~E_DEPRECATED,
      'ignore_silence' => false,
      'assertion_throws_exception' => true,
      'assertion_error_type' => 256,
      'log' => 
      array (
        'class_name' => '\App\Monolog\ExceptionHandlerLog',
      ),
    ),
    'readonly' => false,
  ),

$log = new \App\Log('test');

$log->info('log info message');
$log->debug($_SERVER);
$log->alert([1, 2]);
$log->notice(\Bitrix\Main\Application::getConnection());

$log = new \App\Log('test');
try {
    // my code
} catch(Exception $e) {
    $log->telegram(\Psr\Log\LogLevel::ERROR, $e, ['source' => 'my code error'])
}

$log = new \App\Log('telegram-messenger');

\App\Log::cleanLogs(15);
bash
DOCUMENT_ROOT/APP_LOG_FOLDER/APP_LOG_BITRIX_CHANNEL/YYYY-MM-DD.log