public function addEntry($entry)
	{
		// Set some default field values if not already set.
		$date = new AnDate();

		if (!isset ($entry['date'])) {
			$entry['date'] = $date->format("%Y-%m-%d");
		}

		if (!isset ($entry['time'])) {
			$entry['time'] = $date->format("%H:%M:%S");
		}

		if (!isset ($entry['c-ip'])) {
			$entry['c-ip'] = $_SERVER['REMOTE_ADDR'];
		}

		// Ensure that the log entry keys are all uppercase
		$entry = array_change_key_case($entry, CASE_UPPER);

		// Find all fields in the format string
		$fields = array ();
		$regex = "/{(.*?)}/i";
		preg_match_all($regex, $this->_format, $fields);

		// Fill in the field data
		$line = $this->_format;

		for ($i = 0; $i < count($fields[0]); $i++) {
			$line = str_replace($fields[0][$i], (isset ($entry[$fields[1][$i]])) ? $entry[$fields[1][$i]] : "-", $line);
		}

		// Write the log entry line
		if ($this->_openLog()) {
            return fputs($this->_file, "\n" . $line) ? true : false;
		}

        return false;
	}
public function addEntry($entry)
	{
		// Set some default field values if not already set.
		$date = new AnDate();

		if (!isset ($entry['date'])) {
			$entry['date'] = $date->format("%Y-%m-%d");
		}

		if (!isset ($entry['time'])) {
			$entry['time'] = $date->format("%H:%M:%S");
		}

		if (!isset ($entry['c-ip'])) {
			$entry['c-ip'] = $_SERVER['REMOTE_ADDR'];
		}

		// Ensure that the log entry keys are all uppercase
		$entry = array_change_key_case($entry, CASE_UPPER);

		// Find all fields in the format string
		$fields = array ();
		$regex = "/{(.*?)}/i";
		preg_match_all($regex, $this->_format, $fields);

		// Fill in the field data
		$line = $this->_format;

		for ($i = 0; $i < count($fields[0]); $i++) {
			$line = str_replace($fields[0][$i], (isset ($entry[$fields[1][$i]])) ? $entry[$fields[1][$i]] : "-", $line);
		}

		// Write the log entry line
		if ($this->_openLog()) {
            return fputs($this->_file, "\n" . $line) ? true : false;
		}

        return false;
	}
public function addEntry ( $ entry ) { // Set some default field values if not already set. $ date = new AnDate ( ) ; if ( ! isset ( $ entry [ 'date' ] ) ) { $ entry [ 'date' ] = $ date -> format ( "%Y-%m-%d" ) ; } if ( ! isset ( $ entry [ 'time' ] ) ) { $ entry [ 'time' ] = $ date -> format ( "%H:%M:%S" ) ; } if ( ! isset ( $ entry [ 'c-ip' ] ) ) { $ entry [ 'c-ip' ] = $ _SERVER [ 'REMOTE_ADDR' ] ; } // Ensure that the log entry keys are all uppercase $ entry = array_change_key_case ( $ entry , CASE_UPPER ) ; // Find all fields in the format string $ fields = array ( ) ; $ regex = "/{(.*?)}/i" ; preg_match_all ( $ regex , $ this -> _format , $ fields ) ; // Fill in the field data $ line = $ this -> _format ; for ( $ i = 0 ; $ i < count ( $ fields [ 0 ] ) ; $ i ++ ) { $ line = str_replace ( $ fields [ 0 ] [ $ i ] , ( isset ( $ entry [ $ fields [ 1 ] [ $ i ] ] ) ) ? $ entry [ $ fields [ 1 ] [ $ i ] ] : "-" , $ line ) ; } // Write the log entry line if ( $ this -> _openLog ( ) ) { return fputs ( $ this -> _file , "\n" . $ line ) ? true : false ; } return false ; }
Adds a log entry

@param Array(KEY1=>value1, KEY2=value2, ...) keys must be all upper case

@return boolean TRUE if success
Adds a log entry