Skip to content

Instantly share code, notes, and snippets.

@ig0r74
Last active February 1, 2021 23:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ig0r74/30dc4a96fde1bdb2e4a5168940fd1423 to your computer and use it in GitHub Desktop.
Save ig0r74/30dc4a96fde1bdb2e4a5168940fd1423 to your computer and use it in GitHub Desktop.
MODX Sentry integration
<?php
// Перед этим в консоли "cd core/components && mkdir sentry && composer require sentry/sdk"
switch ($modx->event->name) {
case 'OnMODXInit':
$file = MODX_CORE_PATH.'components/sentry/vendor/autoload.php';
if (file_exists($file)) {
require_once $file;
}
break;
case 'OnWebPageInit':
case 'OnManagerPageInit':
try {
Sentry\init(['dsn' => '111111111111111111111111111111111111111111111111111111111111111' ]);
} catch (Exception $e) {
$modx->log(MODX_LOG_LEVEL_ERROR, 'Sentry Exception: ', $e->getMessage(), "\n");
}
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment