예제 #1
0
 /**
  * Writes the record down to the log of the implementing handler
  *
  * @param  array $record
  * @return void
  */
 protected function write(array $record)
 {
     $severity = $this->getSeverity($record['level']);
     if (isset($record['context']['exception'])) {
         $this->client->notifyException($record['context']['exception'], $record, $severity);
     } else {
         $this->client->notifyError($severity, (string) $record['message'], $record, $severity);
     }
 }
예제 #2
0
파일: Logger.php 프로젝트: styleci/bugsnag
 /**
  * Log a message to the logs.
  *
  * @param string $level
  * @param mixed  $message
  * @param array  $context
  *
  * @return void
  */
 public function log($level, $message, array $context = [])
 {
     $severity = $this->getSeverity($level);
     if ($message instanceof Exception) {
         $this->bugsnag->notifyException($message, array_except($context, ['title']), $severity);
     } else {
         $msg = $this->formatMessage($message);
         $title = array_get($context, 'title', str_limit((string) $msg));
         $this->bugsnag->notifyError($title, $msg, array_except($context, ['title']), $severity);
     }
 }
예제 #3
0
 public function testManualExceptionNotification()
 {
     $this->client->expects($this->once())->method('notify');
     $this->client->notifyException(new Exception("Something broke"));
 }
예제 #4
0
 /**
  * Notify Bugsnag of a non-fatal/handled exception
  *
  * @param \Exception $exception the exception to notify Bugsnag about
  * @param Array $metaData optional metaData to send with this error
  * @param String $severity optional severity of this error (fatal/error/warning/info)
  * @static 
  */
 public static function notifyException($exception, $metaData = null, $severity = null)
 {
     return \Bugsnag_Client::notifyException($exception, $metaData, $severity);
 }