70 $this->_id = md5(microtime());
71 $this->_ident = $ident;
74 if (!empty($conf[
'stream'])) {
75 $this->_stream = $conf[
'stream'];
78 if (isset($conf[
'buffering'])) {
79 $this->_buffering = $conf[
'buffering'];
82 if (!empty($conf[
'lineFormat'])) {
83 $this->_lineFormat = str_replace(array_keys($this->_formatMap),
84 array_values($this->_formatMap),
88 if (!empty($conf[
'timeFormat'])) {
89 $this->_timeFormat = $conf[
'timeFormat'];
96 if ($this->_buffering) {
97 register_shutdown_function(array(&$this,
'_Log_console'));
117 $this->_opened =
true;
132 $this->_opened =
false;
148 if ($this->_buffering && (strlen($this->_buffer) > 0)) {
149 fwrite($this->_stream, $this->_buffer);
153 if (is_resource($this->_stream)) {
154 return fflush($this->_stream);
172 function log($message, $priority = null)
175 if ($priority === null) {
188 $line = $this->
_format($this->_lineFormat,
189 strftime($this->_timeFormat),
190 $priority, $message) .
"\n";
196 if ($this->_buffering) {
197 $this->_buffer .= $line;
199 fwrite($this->_stream, $line);
203 $this->
_announce(array(
'priority' => $priority,
'message' => $message));
_announce($event)
Informs each registered observer instance that a new message has been logged.
flush()
Flushes all pending ("buffered") data to the output stream.
UPTO($priority)
Calculate the log mask for all priorities up to the given priority.
open()
Open the output stream.
log($message, $priority=null)
Writes $message to the text console.
_Log_console()
Destructor.
_isMasked($priority)
Check if the given priority is included in the current level mask.
_extractMessage($message)
Returns the string representation of the message data.
close()
Closes the output stream.
_format($format, $timestamp, $priority, $message)
Produces a formatted log line based on a format string and a set of variables representing the curren...
Log_console($name, $ident='', $conf=array(), $level=PEAR_LOG_DEBUG)
Constructs a new Log_console object.