fishbones/core/Log.php
/**
	 * opens log file
	 * 
	 * opens log file, if clearAtStart is true, also clear it.
	 * @return boolean true on sucess, false on error
	 */
opens log file

opens log file, if clearAtStart is true, also clear it.
@return boolean true on sucess, false on error
opens log file opens log file if clearAtStart is true also clear it . @return boolean true on sucess false on error
public function openLogFile() {	
		if( ! (Fishbones::getConfig()->debugLog ) ) { 
			return true;
		}
		$logsDir = Fishbones::getConfig()->currentPathToStart .
				Fishbones::getConfig()->currentPathToFishbones .
				'logs';
		if( ! file_exists( $logsDir ) ) {
			mkdir( $logsDir, 0777 );
		}
		if( $this->clearAtStart ) {
			$this->file = fopen( Fishbones::getConfig()->currentPathToStart .
				Fishbones::getConfig()->currentPathToFishbones .
				'logs/' .
				$this->filename, 'wt' );
		} else {
			$logCurrentSize = filesize(
				Fishbones::getConfig()->currentPathToStart .
				Fishbones::getConfig()->currentPathToFishbones .
				'logs/' .
				$this->filename
			);
			$this->file = fopen( Fishbones::getConfig()->currentPathToStart .
				Fishbones::getConfig()->currentPathToFishbones .
				'logs/' .
				$this->filename, 'at' );
			if( $logCurrentSize > $this->maxSize ) {
				copy(
					Fishbones::getConfig()->currentPathToStart .
					Fishbones::getConfig()->currentPathToFishbones .
					'logs/' .
					$this->filename,
					Fishbones::getConfig()->currentPathToStart .
					Fishbones::getConfig()->currentPathToFishbones .
					'logs/' .
					'otherLog'
				);
				ftruncate( $this->file, 0 );
			}
		}
		if ( $this->file ) {
			return true;
		} else {
			return false;
		}
	}
public function openLogFile ( ) { if ( ! ( Fishbones :: getConfig ( ) -> debugLog ) ) { return true ; } $ logsDir = Fishbones :: getConfig ( ) -> currentPathToStart . Fishbones :: getConfig ( ) -> currentPathToFishbones . 'logs' ; if ( ! file_exists ( $ logsDir ) ) { mkdir ( $ logsDir , 0777 ) ; } if ( $ this -> clearAtStart ) { $ this -> file = fopen ( Fishbones :: getConfig ( ) -> currentPathToStart . Fishbones :: getConfig ( ) -> currentPathToFishbones . 'logs/' . $ this -> filename , 'wt' ) ; } else { $ logCurrentSize = filesize ( Fishbones :: getConfig ( ) -> currentPathToStart . Fishbones :: getConfig ( ) -> currentPathToFishbones . 'logs/' . $ this -> filename ) ; $ this -> file = fopen ( Fishbones :: getConfig ( ) -> currentPathToStart . Fishbones :: getConfig ( ) -> currentPathToFishbones . 'logs/' . $ this -> filename , 'at' ) ; if ( $ logCurrentSize > $ this -> maxSize ) { copy ( Fishbones :: getConfig ( ) -> currentPathToStart . Fishbones :: getConfig ( ) -> currentPathToFishbones . 'logs/' . $ this -> filename , Fishbones :: getConfig ( ) -> currentPathToStart . Fishbones :: getConfig ( ) -> currentPathToFishbones . 'logs/' . 'otherLog' ) ; ftruncate ( $ this -> file , 0 ) ; } } if ( $ this -> file ) { return true ; } else { return false ; } }
opens log file
opens log file
// create logs directory if it don't exists //$this->file = fopen( $this->filename, 'wt' ); //$this->file = fopen( $this->filename, 'at' );