PHP code example of webarchitect609 / bitrix-exception-logger
1. Go to this page and download the library: Download webarchitect609/bitrix-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/ */
webarchitect609 / bitrix-exception-logger example snippets
[
//...
'exception_handling' =>
[
'value' =>
[
'debug' => false,
'handled_errors_types' => E_ERROR
| E_PARSE
| E_CORE_ERROR
| E_COMPILE_ERROR
| E_USER_ERROR
| E_RECOVERABLE_ERROR,
'exception_errors_types' => E_ERROR
| E_PARSE
| E_CORE_ERROR
| E_COMPILE_ERROR
| E_USER_ERROR
| E_RECOVERABLE_ERROR,
'ignore_silence' => false,
'assertion_throws_exception' => true,
'assertion_error_type' => E_USER_ERROR,
'log' => [
'class_name' => \WebArch\BitrixExceptionLogger\ExceptionLogger::class,
'settings' => [
/**
* Логгер типа \Psr\Log\LoggerInterface. Обязательная опция.
*/
'logger' => new \Monolog\Logger(
'BX_EXPN',
new \Monolog\Handler\StreamHandler(
'/var/log/www_exception.log', \Psr\Log\LogLevel::INFO
)
),
/**
* Битриксовые типы сообщений, которые будут записываться в лог. Необязательная опция.
* (по умолчанию пишутся все типы, кроме \Bitrix\Main\Diag\ExceptionHandlerLog::LOW_PRIORITY_ERROR )
*/
'types' => [
\Bitrix\Main\Diag\ExceptionHandlerLog::UNCAUGHT_EXCEPTION,
\Bitrix\Main\Diag\ExceptionHandlerLog::IGNORED_ERROR,
\Bitrix\Main\Diag\ExceptionHandlerLog::FATAL,
]
],
],
],
'readonly' => true,
],
//...
]