示例#1
0
 protected function _execute(array $options)
 {
     Kohana::$log->add(Log::ERROR, "Test error!");
     Kohana::$log->add(Log::WARNING, "Test warning!");
     Kohana::$log->add(Log::INFO, "Test info!");
     Raven::instance()->captureException(new Kohana_Minion_Exception_InvalidTask("That was invalid task message", array('variable' => 'value'), 451));
 }
示例#2
0
 public static function handler($e)
 {
     Raven::instance()->captureException($e);
     //Kohana handler adds a Log::ERROR string to log, so double-sending would be undesired
     Kohana::$log->detach(Log_Raven::instance());
     parent::handler($e);
     //there's death call
 }
示例#3
0
 public static function instance()
 {
     if (self::$instance === null) {
         $api = Kohana::$config->load('raven.api');
         if ($api === null) {
             throw new RuntimeException("Could not find Sentry API key. Please setup config/raven");
         }
         self::$instance = new Raven_Client($api);
     }
     return self::$instance;
 }
示例#4
0
 public function write(array $messages)
 {
     if (count($messages) == 0) {
         return;
     }
     if (!Kohana::$config->load('raven.enabled')) {
         return;
     }
     $r = Raven::instance();
     foreach ($messages as $message) {
         $r->captureMessage($message['body'], null, $r->translateSeverity($message['level']));
     }
 }
示例#5
0
<?php

defined('SYSPATH') or die('No direct script access.');
require_once Kohana::find_file('vendor', 'lib/Raven/Autoloader');
Raven_Autoloader::register();
Raven::instance()->registerSeverityMap(array(Log::EMERGENCY => Raven_Client::FATAL, Log::ALERT => Raven_Client::FATAL, Log::CRITICAL => Raven_Client::FATAL, Log::ERROR => Raven_Client::ERROR, Log::WARNING => Raven_Client::WARN, Log::NOTICE => Raven_Client::INFO, Log::INFO => Raven_Client::INFO, Log::DEBUG => Raven_Client::DEBUG, Log::STRACE => Raven_Client::DEBUG));
示例#6
0
 /**
  * Creates a new RavenResponse with raven data.
  *
  * @param httpResponseHeader   the response header returned with the request
  * @param ravenResponseString  the response string as returned by raven
  * @param operation            the operation that initiated this response
  * @throws                     RavenNoResponseException if inquiry must be made
  * @throws                     RavenAuthentication if the response could be determined to originate with Raven	
  * @throws                     Exception on unknown http status
  */
 public function __construct($httpResponseHeader, $ravenResponseString, $operation, $options)
 {
     parent::__construct($operation, $options);
     $this->ravenResponseString = $ravenResponseString;
     $this->log("Response string: " . htmlspecialchars(urldecode($ravenResponseString)));
     $this->operation = $operation;
     $httpResponse = null;
     if ($httpResponseHeader == null) {
         $this->log("No response received.");
         throw new RavenNoResponseException('inquire again');
     }
     $this->setHttpHeader($httpResponseHeader);
     switch ($this->get('httpStatus')) {
         case 200:
             // we received an expected response string from Raven
             $this->log("Received HTTP response 200");
             $this->parseResponse($ravenResponseString);
             break;
         case 500:
             // inquire, because the request may or may not have been processed
             $this->log("Received HTTP response 500: Request may or may not have been processed, inquire");
             throw new RavenNoResponseException('inquire again');
             break;
         default:
             $this->log("Received HTTP response " . $this->get('httpStatus'));
             break;
     }
 }