- Issue created by @carles.zapater
- πͺπΈSpain carles.zapater
Tested in hook_cron()
function raven_sict_cron() {
\Drupal::logger('raven_sict')->notice('Notice');
\Drupal::logger('raven_sict')->warning('Warning!');
\Drupal::logger('raven_sict')->alert('Alert!');
\Drupal::logger('raven_sict')->critical('Critical!');
\Drupal::logger('raven_sict')->emergency('Emergency!');
\Drupal::logger('raven_sict')->debug('Debug');
\Drupal::logger('raven_sict')->error('Error!');
\Drupal::logger('raven_sict')->info('Info');
} - Status changed to Postponed: needs info
about 1 year ago 4:03pm 14 November 2023 - πΊπΈUnited States mfb San Francisco
Your code worked for me when I tested. Did you add it to your raven_sict.services.yml file?
Should look like this:
Drupal\raven_sict\EventSubscriber\RavenOptionsAlterSubscriber: tags: - { name: event_subscriber }
- πͺπΈSpain carles.zapater
Yes, I have added the service.
The problem is that ignores the 'before_breadcrumb' option. However, it does work with the 'before_send' option.
public function onOptionsAlter(\Drupal\raven\Event\OptionsAlter $alterEvent): void { // Disable Breadcrumb (Logging) // https://docs.sentry.io/platforms/php/enriching-events/breadcrumbs/#customize-breadcrumbs $alterEvent->options['before_send'] = function (\Sentry\Event $event): ?\Sentry\Event { if (in_array($event->getLevel(), ['warning', 'error', 'fatal'])) { return $event; } return null; }; }
I have also been able to observe that the 'log_levels' configuration of the configuration form is not used. Breadcrumbs of all levels are always created.
- πΊπΈUnited States mfb San Francisco
Are you confusing events and breadcrumbs?
The "log levels" configuration is for events. before_send is for events.
There is no configuration for breadcrumbs (yet, although we could add it). before_breadcrumb is for breadcrumbs
- πͺπΈSpain carles.zapater
Sorry I want to filter log levels. If level checkboxes are selected in the configuration form, they are not filtered and all are passed.
I have also been able to observe that the 'log_levels' configuration of the configuration form is not used.
I have not seen in the source code that this setting is used. - Status changed to Active
about 1 year ago 4:37pm 14 November 2023 - πΊπΈUnited States mfb San Francisco
Ah, yes, there is a bug in 5.x branch, I accidentally removed that line of code while removing support for the old hooks. Thanks for reporting this
- Status changed to Needs review
about 1 year ago 4:49pm 14 November 2023 - last update
about 1 year ago 30 pass - last update
about 1 year ago 28 pass, 1 fail The last submitted patch, 10: 3401522-9-TEST-ONLY-FAIL.patch, failed testing. View results β
- last update
about 1 year ago 30 pass - πͺπΈSpain carles.zapater
Thanks! Could you check the 4.x branch too?
- πΊπΈUnited States mfb San Francisco
This is a new issue because I changed that line of code when creating the 5.x branch.
So I'm not going to check 4.x branch now, but if it turns out there's a problem please update this issue.
- Status changed to Fixed
about 1 year ago 6:32pm 14 November 2023