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));