/** * 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); } }
/** * 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); } }
public function testManualExceptionNotification() { $this->client->expects($this->once())->method('notify'); $this->client->notifyException(new Exception("Something broke")); }
/** * 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); }