You are here

function drush_raven_capture_message in Raven: Sentry Integration 7.4

Same name and namespace in other branches
  1. 7.2 raven.drush.inc \drush_raven_capture_message()
  2. 7.3 raven.drush.inc \drush_raven_capture_message()

Sends a test message to Sentry.

File

./raven.drush.inc, line 43
Raven module drush integration.

Code

function drush_raven_capture_message($message = 'Test message from Drush.') {
  $client = raven_get_client();
  if (!$client) {
    return drush_set_error('RAVEN_CLIENT', dt('Raven client not available.'));
  }
  $level = drush_get_option('level', 'info');
  $id = \Sentry\captureMessage($message, new Severity($level));
  if (!$id) {
    return drush_set_error('RAVEN_SEND', dt('Send failed.'));
  }
  drush_log(dt('Message sent as event !id.', [
    '!id' => $id,
  ]), 'success');
}