public function setLogFile($filePath)
    {
        if ($this->logFile != $filePath && $this->fp) {
            @fclose($this->fp);
            $this->fp = null;
        }
        $logDir = dirname($filePath);
        if (!file_exists($logDir)) {
            @mkdir($logDir, 0755, true);
        }

        if (!file_exists($logDir)) {
            throw new Exception(sprintf('Can\'t create log directory "%s".', $logDir), 'logger');
        }

        if (!$this->fp = @fopen($filePath, 'a+')) {
            throw new Exception(sprintf('Can\'t create log file "%s".', $filePath), 'logger');
        }

        $this->logFile = $filePath;
        return $this;
    }
public function setLogFile($filePath)
    {
        if ($this->logFile != $filePath && $this->fp) {
            @fclose($this->fp);
            $this->fp = null;
        }
        $logDir = dirname($filePath);
        if (!file_exists($logDir)) {
            @mkdir($logDir, 0755, true);
        }

        if (!file_exists($logDir)) {
            throw new Exception(sprintf('Can\'t create log directory "%s".', $logDir), 'logger');
        }

        if (!$this->fp = @fopen($filePath, 'a+')) {
            throw new Exception(sprintf('Can\'t create log file "%s".', $filePath), 'logger');
        }

        $this->logFile = $filePath;
        return $this;
    }
public function setLogFile ( $ filePath ) { if ( $ this -> logFile != $ filePath && $ this -> fp ) { @ fclose ( $ this -> fp ) ; $ this -> fp = null ; } $ logDir = dirname ( $ filePath ) ; if ( ! file_exists ( $ logDir ) ) { @ mkdir ( $ logDir , 0755 , true ) ; } if ( ! file_exists ( $ logDir ) ) { throw new Exception ( sprintf ( 'Can\'t create log directory "%s".' , $ logDir ) , 'logger' ) ; } if ( ! $ this -> fp = @ fopen ( $ filePath , 'a+' ) ) { throw new Exception ( sprintf ( 'Can\'t create log file "%s".' , $ filePath ) , 'logger' ) ; } $ this -> logFile = $ filePath ; return $ this ; }
Set the log file path
@param $filePath
@throws Exception
@return $this
Set the log file path