protected static function sentryLog(Exception $exception) { if (Configure::read('debug') == 0 || !Configure::read('Sentry.production_only')) { Raven_Autoloader::register(); App::uses('CakeRavenClient', 'Sentry.Lib'); $client = new CakeRavenClient(Configure::read('Sentry.PHP.server')); $client->captureException($exception, get_class($exception), 'PHP'); } }
/** * Implements writing to sentry server. * * @param string $type The type of log you are making. * @param string $message The message you want to log. * @return boolean success of write */ public function write($type, $message) { if (is_null($this->__client)) { return false; } $_typesMapping = array('notice' => CakeRavenClient::INFO, 'info' => CakeRavenClient::INFO, 'debug' => CakeRavenClient::DEBUG, 'error' => CakeRavenClient::ERROR, 'warning' => CakeRavenClient::WARNING); $level = array_key_exists($type, $_typesMapping) ? $_typesMapping[$type] : CakeRavenClient::INFO; $this->__client->captureMessage($message, array(), $level); return true; }