_stream = $streamOrUrl; } else { if (! $this->_stream = @fopen($streamOrUrl, $mode, false)) { $msg = "\"$streamOrUrl\" cannot be opened with mode \"$mode\""; throw new Zend_Log_Exception($msg); } } $this->_formatter = new Zend_Log_Formatter_Simple(); } /** * Close the stream resource. * * @return void */ public function shutdown() { if (is_resource($this->_stream)) { fclose($this->_stream); } } /** * Write a message to the log. * * @param array $event event data * @return void */ protected function _write($event) { $line = $this->_formatter->format($event); if ( fwrite($this->_stream, $line) === false) { throw new Zend_Log_Exception("Unable to write to stream"); } } }