You are here

function drush_raven_capture_message in Raven: Sentry Integration 7.2

Same name and namespace in other branches
  1. 7.4 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 42
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');
  $logger = drush_get_option('logger', 'drush');
  $id = $client
    ->captureMessage($message, array(), array(
    'level' => $level,
    'logger' => $logger,
  ));
  if (!$id) {
    return drush_set_error('RAVEN_SEND', dt('Send failed.'));
  }
  drush_log(dt('Message sent as event !id.', array(
    '!id' => $id,
  )), 'success');
}