5 * @version $Revision: 215527 $
10 * The Log_null class is a concrete implementation of the Log:: abstract
11 * class. It simply consumes log events.
13 * @author Jon Parise <jon@php.net>
17 * @example null.php Using the null handler.
19 class Log_null extends Log
22 * Constructs a new Log_null object.
24 * @param string $name Ignored.
25 * @param string $ident The identity string.
26 * @param array $conf The configuration array.
27 * @param int $level Log messages up to and including this level.
30 function Log_null($name, $ident = '', $conf = array(),
31 $level = PEAR_LOG_DEBUG)
33 $this->_id = md5(microtime());
34 $this->_ident = $ident;
35 $this->_mask = Log::UPTO($level);
46 $this->_opened = true;
58 $this->_opened = false;
63 * Simply consumes the log event. The message will still be passed
64 * along to any Log_observer instances that are observing this Log.
66 * @param mixed $message String or object containing the message to log.
67 * @param string $priority The priority of the message. Valid
68 * values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,
69 * PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,
70 * PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
71 * @return boolean True on success or false on failure.
74 function log($message, $priority = null)
76 /* If a priority hasn't been specified, use the default value. */
77 if ($priority === null) {
78 $priority = $this->_priority;
81 /* Abort early if the priority is above the maximum logging level. */
82 if (!$this->_isMasked($priority)) {
86 $this->_announce(array('priority' => $priority, 'message' => $message));