Skip to content

Commit

Permalink
new options
Browse files Browse the repository at this point in the history
  • Loading branch information
EsdrasCaleb committed Jul 10, 2024
1 parent b2be9b0 commit a0c7d3e
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 2 deletions.
5 changes: 5 additions & 0 deletions lang/en/tool_sentry.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@
$string['pluginsettigs'] = "Sentry Configuration";
$string['dns'] = "Sentry Server DNS";
$string['privacy:metadata'] = 'The plugin does not store any personal data. However, it send the IP of a user that had an error to the sentry server configured in it.';
$string['never'] = "Request bodies are never sent.";
$string['small'] = "Only small request bodies will be captured (typically 4KB)";
$string['medium'] = "Medium and small requests will be captured (typically 10KB)";
$string['always'] = "The SDK will always capture the request body as long as Sentry can make sense of it.";

59 changes: 57 additions & 2 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,68 @@

defined('MOODLE_INTERNAL') || die;

global $CFG;
global $CFG, $ADMIN;

if (is_siteadmin()) {
if (!$ADMIN->locate('tool_sentry')) {
$page = new admin_settingpage('sentryconfig', get_string('pluginsettigs', 'tool_sentry'));
$page->add(new admin_setting_configtext('tool_sentry/dns', get_string('dns', 'tool_sentry'),
'', 'https://[email protected]/CLIENTCODE'));
get_string('dns_desc', 'tool_sentry'), 'https://[email protected]/CLIENTCODE'));
$page->add(new admin_setting_configtext('tool_sentry/release', get_string('release', 'tool_sentry'),
get_string('release_desc', 'tool_sentry'), ''));
$page->add(new admin_setting_configcheckbox('tool_sentry/activate',
get_string('activate', 'tool_sentry'),get_string('activate_desc', 'tool_sentry'),1));
$page->add(new admin_setting_configcheckbox('tool_sentry/send_default_pii',
get_string('send_default_pii', 'tool_sentry'),get_string('send_default_pii_desc', 'tool_sentry'),0));
$page->add(new admin_setting_configtext('tool_sentry/sample_rate', get_string('sample_rate', 'tool_sentry'),
get_string('sample_rate_desc', 'tool_sentry'),1,PARAM_FLOAT));
$page->add(new admin_setting_configtext('tool_sentry/traces_sample_rate', get_string('traces_sample_rate', 'tool_sentry'),
get_string('traces_sample_rate_desc', 'tool_sentry'),1,PARAM_FLOAT));
$page->add(new admin_setting_configtext('tool_sentry/max_breadcrumbs', get_string('max_breadcrumbs', 'tool_sentry'),
get_string('max_breadcrumbs_desc', 'tool_sentry'),100,PARAM_INT));
$page->add(new admin_setting_configselect('tool_sentry/max_request_body_size', get_string('max_request_body_size', 'tool_sentry'),
get_string('max_request_body_size_desc', 'tool_sentry'),'medium', [
'never'=>get_string('never', 'tool_sentry'), 'small'=>get_string('small', 'tool_sentry'),
'medium'=>get_string('medium', 'tool_sentry'), 'always'=>get_string('always', 'tool_sentry'),
]));
$page->add(new admin_setting_configcheckbox('tool_sentry/enable_tracing',
get_string('enable_tracing', 'tool_sentry'),get_string('enable_tracing_desc', 'tool_sentry'),1));
$page->add(new admin_setting_configcheckbox('tool_sentry/attach_stacktrace',
get_string('attach_stacktrace', 'tool_sentry'),get_string('attach_stacktrace_desc', 'tool_sentry'),1));
$page->add(new admin_setting_configtext('tool_sentry/max_value_length', get_string('max_value_length', 'tool_sentry'),
get_string('max_value_length_desc', 'tool_sentry'),1024,PARAM_INT));

$page->add(new admin_setting_configtext('tool_sentry/environment', get_string('environment', 'tool_sentry'),
get_string('environment_desc', 'tool_sentry'), ''));

$page->add(new admin_setting_configselect('tool_sentry/error_types', get_string('error_types', 'tool_sentry'),
get_string('error_types_desc', 'tool_sentry'),'medium', [
E_ERROR => 'E_ERROR',
E_WARNING => 'E_WARNING',
E_PARSE => 'E_PARSE',
E_NOTICE => 'E_NOTICE',
E_CORE_ERROR => 'E_CORE_ERROR',
E_CORE_WARNING => 'E_CORE_WARNING',
E_COMPILE_ERROR => 'E_COMPILE_ERROR',
E_COMPILE_WARNING => 'E_COMPILE_WARNING',
E_USER_ERROR => 'E_USER_ERROR',
E_USER_WARNING => 'E_USER_WARNING',
E_USER_NOTICE => 'E_USER_NOTICE',
E_STRICT => 'E_STRICT',
E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR',
E_DEPRECATED => 'E_DEPRECATED',
E_USER_DEPRECATED => 'E_USER_DEPRECATED',
E_ALL => 'E_ALL',
]));
$page->add(new admin_setting_configtext('tool_sentry/server_name', get_string('server_name', 'tool_sentry'),
get_string('server_name_desc', 'tool_sentry'), ''));
$page->add(new admin_setting_configtext('tool_sentry/ignore_exceptions',
get_string('ignore_exceptions', 'tool_sentry'),get_string('ignore_exceptions_desc', 'tool_sentry'), ''));
$page->add(new admin_setting_configtext('tool_sentry/ignore_transactions',
get_string('ignore_transactions', 'tool_sentry'),get_string('ignore_transactions_desc', 'tool_sentry'), ''));
$page->add(new admin_setting_configtext('tool_sentry/in_app_include',
get_string('in_app_include', 'tool_sentry'),get_string('in_app_include_desc', 'tool_sentry'), ''));

$ADMIN->add('tools', $page);

}
Expand Down

0 comments on commit a0c7d3e

Please sign in to comment.