Automatically exported from code.google.com/p/planningalerts
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

null.php 2.0 KiB

17 lat temu
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * $Header: /home/ppcvs/paypal_php_sdk/Log/null.php,v 1.1 2006/02/19 08:22:29 dennis Exp $
  4. *
  5. * @version $Revision: 1.1 $
  6. * @package Log
  7. */
  8. /**
  9. * The Log_null class is a concrete implementation of the Log:: abstract
  10. * class. It simply consumes log events.
  11. *
  12. * @author Jon Parise <jon@php.net>
  13. * @since Log 1.8.2
  14. * @package Log
  15. *
  16. * @example null.php Using the null handler.
  17. */
  18. class Log_null extends Log
  19. {
  20. /**
  21. * Constructs a new Log_null object.
  22. *
  23. * @param string $name Ignored.
  24. * @param string $ident The identity string.
  25. * @param array $conf The configuration array.
  26. * @param int $level Log messages up to and including this level.
  27. * @access public
  28. */
  29. function Log_null($name, $ident = '', $conf = array(),
  30. $level = PEAR_LOG_DEBUG)
  31. {
  32. $this->_id = md5(microtime());
  33. $this->_ident = $ident;
  34. $this->_mask = Log::UPTO($level);
  35. }
  36. /**
  37. * Simply consumes the log event. The message will still be passed
  38. * along to any Log_observer instances that are observing this Log.
  39. *
  40. * @param mixed $message String or object containing the message to log.
  41. * @param string $priority The priority of the message. Valid
  42. * values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,
  43. * PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,
  44. * PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
  45. * @return boolean True on success or false on failure.
  46. * @access public
  47. */
  48. function log($message, $priority = null)
  49. {
  50. /* If a priority hasn't been specified, use the default value. */
  51. if ($priority === null) {
  52. $priority = $this->_priority;
  53. }
  54. /* Abort early if the priority is above the maximum logging level. */
  55. if (!$this->_isMasked($priority)) {
  56. return false;
  57. }
  58. $this->_announce(array('priority' => $priority, 'message' => $message));
  59. return true;
  60. }
  61. }