1. Go to this page and download the library: Download m8rge/yii-sentry-log 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/ */
m8rge / yii-sentry-log example snippets
...
'components'=>array(
...
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'application.components.yii-sentry-log.RSentryLog',
'dsn'=> '[YOUR_DSN_FROM_SENTRY_SERVER]',
'levels'=>'error, warning',
// optional
// adds to user context values from arrays or objects chains from $GLOBAL
// skips if anything from the chain is absent (respects attributes, but not other getters)
// NB! default values for user context will disappear and these values will be added
'context' => [
// adds $GLOBALS['_SESSION']['user']->username under 'nameOfUser' key
'nameOfUser' => ['_SESSION', 'user', 'username'],
// adds $GLOBALS['_SESSION']['user']->username under '_SESSION:user:email' key
['_SESSION', 'user', 'email'],
// adds $GLOBALS['_SESSION']['optionalObject']->someProperty['someSubKey'] value, skips if absent
'optionalValue' => ['_SESSION', 'optionalObject', 'someProperty', 'someSubKey'],
]
),
),
),
...
)
...
'preload'=> array('log', 'RSentryException'),
'components'=>array(
...
'RSentryException'=> array(
'dsn'=> '[YOUR_DSN_FROM_SENTRY_SERVER]',
'class' => 'application.components.yii-sentry-log.RSentryComponent',
// optional
// adds to user context values from arrays or objects chains from $GLOBAL
// skips if anything from the chain is absent (respects attributes, but not other getters)
// NB! default values for user context will disappear and these values will be added
'context' => [
// adds $GLOBALS['_SESSION']['user']->username under 'nameOfUser' key
'nameOfUser' => ['_SESSION', 'user', 'username'],
// adds $GLOBALS['_SESSION']['user']->username under '_SESSION:user:email' key
['_SESSION', 'user', 'email'],
// adds $GLOBALS['_SESSION']['optionalObject']->someProperty['someSubKey'] value, skips if absent
'optionalValue' => ['_SESSION', 'optionalObject', 'someProperty', 'someSubKey'],
]
),
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'application.components.yii-sentry-log.RSentryLog',
'dsn'=> '[YOUR_DSN_FROM_SENTRY_SERVER]',
'levels'=>'error, warning',
// optional
// adds to user context values from arrays or objects chains from $GLOBAL
// skips if anything from the chain is absent (respects attributes, but not other getters)
// NB! default values for user context will disappear and these values will be added
'context' => [
// adds $GLOBALS['_SESSION']['user']->username under 'nameOfUser' key
'nameOfUser' => ['_SESSION', 'user', 'username'],
// adds $GLOBALS['_SESSION']['user']->username under '_SESSION:user:email' key
['_SESSION', 'user', 'email'],
// adds $GLOBALS['_SESSION']['optionalObject']->someProperty['someSubKey'] value, skips if absent
'optionalValue' => ['_SESSION', 'optionalObject', 'someProperty', 'someSubKey'],
],
'exceptTitle' => [ // array of regex patterns
"/^exception '([^ ]*)' with message/",
],
),
),
),
...
)
...
config.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.