Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. Raven.config('http://blahblahblah@localhost:9000/2', { logger:'my-logger', whitelistUrls:[], ignoreErrors:[], includePaths:[] } ).install();
  2.  
  3. Raven_Autoloader::register();
  4. $client = new Raven_Client('http://blahblahblah@localhost:9000/2', array('logger' => 'my-logger'));
  5.  
  6. $error_handler = new Raven_ErrorHandler($client);
  7. set_error_handler(array($error_handler, 'handleError'));
  8. set_exception_handler(array($error_handler, 'handleException'));
  9.  
  10. /**
  11. * Parses a Raven-compatible DSN and returns an array of its values.
  12. */
  13. public static function parseDSN($dsn)
  14. {
  15. $url = parse_url($dsn);
  16. $scheme = (isset($url['scheme']) ? $url['scheme'] : '');
  17. if (!in_array($scheme, array('http', 'https', 'udp'))) {
  18. throw new InvalidArgumentException('Unsupported Sentry DSN scheme: ' . (!empty($scheme) ? $scheme : '<not set>'));
  19. }
  20. $netloc = (isset($url['host']) ? $url['host'] : null);
  21. $netloc.= (isset($url['port']) ? ':'.$url['port'] : null);
  22. $rawpath = (isset($url['path']) ? $url['path'] : null);
  23. if ($rawpath) {
  24. $pos = strrpos($rawpath, '/', 1);
  25. if ($pos !== false) {
  26. $path = substr($rawpath, 0, $pos);
  27. $project = substr($rawpath, $pos + 1);
  28. } else {
  29. $path = '';
  30. $project = substr($rawpath, 1);
  31. }
  32. } else {
  33. $project = null;
  34. $path = '';
  35. }
  36. $username = (isset($url['user']) ? $url['user'] : null);
  37. $password = (isset($url['pass']) ? $url['pass'] : null);
  38. if (empty($netloc) || empty($project) || empty($username) || empty($password)) {
  39. throw new InvalidArgumentException('Invalid Sentry DSN: ' . $dsn);
  40. }
  41. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement