protected function writeLog($level, $message, array $context = array())
    {
        if (!is_resource($this->stream)) {
            if (!isset($this->url)) {
                throw new Mustache_Exception_LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().');
            }

            $this->stream = fopen($this->url, 'a');
            if (!is_resource($this->stream)) {
                // @codeCoverageIgnoreStart
                throw new Mustache_Exception_RuntimeException(sprintf('The stream or file "%s" could not be opened.', $this->url));
                // @codeCoverageIgnoreEnd
            }
        }

        fwrite($this->stream, self::formatLine($level, $message, $context));
    }
protected function writeLog($level, $message, array $context = array())
    {
        if (!is_resource($this->stream)) {
            if (!isset($this->url)) {
                throw new Mustache_Exception_LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().');
            }

            $this->stream = fopen($this->url, 'a');
            if (!is_resource($this->stream)) {
                // @codeCoverageIgnoreStart
                throw new Mustache_Exception_RuntimeException(sprintf('The stream or file "%s" could not be opened.', $this->url));
                // @codeCoverageIgnoreEnd
            }
        }

        fwrite($this->stream, self::formatLine($level, $message, $context));
    }
protected function writeLog ( $ level , $ message , array $ context = array ( ) ) { if ( ! is_resource ( $ this -> stream ) ) { if ( ! isset ( $ this -> url ) ) { throw new Mustache_Exception_LogicException ( 'Missing stream url, the stream can not be opened. This may be caused by a premature call to close().' ) ; } $ this -> stream = fopen ( $ this -> url , 'a' ) ; if ( ! is_resource ( $ this -> stream ) ) { // @codeCoverageIgnoreStart throw new Mustache_Exception_RuntimeException ( sprintf ( 'The stream or file "%s" could not be opened.' , $ this -> url ) ) ; // @codeCoverageIgnoreEnd } } fwrite ( $ this -> stream , self :: formatLine ( $ level , $ message , $ context ) ) ; }
Write a record to the log.

@throws Mustache_Exception_LogicException   If neither a stream resource nor url is present
@throws Mustache_Exception_RuntimeException If the stream url cannot be opened

@param int    $level   The logging level
@param string $message The log message
@param array  $context The log context
Write a record to the log .