Exception.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * Horde base exception class.
  4. *
  5. * Copyright 2008-2013 Horde LLC (http://www.horde.org/)
  6. *
  7. * See the enclosed file COPYING for license information (LGPL). If you
  8. * did not receive this file, see http://www.horde.org/licenses/lgpl21.
  9. *
  10. * @category Horde
  11. * @license http://www.horde.org/licenses/lgpl21 LGPL-2.1
  12. * @package Exception
  13. */
  14. class Horde_Exception extends Exception
  15. {
  16. /**
  17. * Error details that should not be part of the main exception message,
  18. * e.g. any additional debugging information.
  19. *
  20. * @var string
  21. */
  22. public $details;
  23. /**
  24. * Has this exception been logged?
  25. *
  26. * @var boolean
  27. */
  28. public $logged = false;
  29. /**
  30. * The log level to use. A Horde_Log constant.
  31. *
  32. * @var integer
  33. */
  34. protected $_logLevel = 0;
  35. /**
  36. * Get the log level.
  37. *
  38. * @return integer The Horde_Log constant for the log level.
  39. */
  40. public function getLogLevel()
  41. {
  42. return $this->_logLevel;
  43. }
  44. /**
  45. * Sets the log level.
  46. *
  47. * @param mixed $level The log level.
  48. */
  49. public function setLogLevel($level = 0)
  50. {
  51. if (is_string($level)) {
  52. $level = defined('Horde_Log::' . $level)
  53. ? constant('Horde_Log::' . $level)
  54. : 0;
  55. }
  56. $this->_logLevel = $level;
  57. }
  58. }