Log message in the specified log file
@param string $delimeter
@return object
498494
public function logMessage (string $delimeter="|")
    {
    	// Validates Message
        if ($this->validateAttribute("message") == FALSE) return $this;
    	// Validates Message Level
        if ($this->validateAttribute("level") == FALSE) return $this;
    	// Validates Log File
        if ($this->validateAttribute("logFile") == FALSE) return $this;
        // Sets the Log File.
    	$this->processLogFile();

        // Ensure all messages have a final line return
        $datetime 		= strftime("%Y-%m-%d %H:%M:%S", time());
        $logMessage 	= "{$datetime} $delimeter {$this->level} $delimeter {$this->message}".PHP_EOL;

        // FILE_APPEND adds content to the end of the file
        // LOCK_EX forbids writing to the file while in use by us
        file_put_contents($this->logFile, $logMessage, FILE_APPEND | LOCK_EX);
		return $this;
    }
495054
public function Log($logMessage)
    {
        $target = null;

        if ($user = Sentinel::getUser())
            if ($user != null)
                $target = $user->id;

        $log = $this->getLogsRepository()->create(['log' => $logMessage, 'ip' => Request::ip(), 'target' => $target]);
    }
959431
public function read($delim = '#')
    {
        $file = file_get_contents($this->file);

        $delim = preg_quote($delim);
        if (preg_match("/#\s$delim\s(.*?)\s#\s\\\\$delim/s", $file, $matches)) {
            return trim($matches[1]);
        } else {
            return false;
        }
    }
752237
public function readFile (string $logFile=NULL, array $keys=[], string $order="desc", string $delimeter="|")
    {
		$this->readResult 	= [];
		$this->logFile 		= $logFile;
		$this->keys 		= $keys;
		$this->delimeter 	= $delimeter;

    	// Validates Log File
        if ($this->validateAttribute("logFile") == FALSE) return $this;
    	// Validates Delimeter
        if ($this->validateAttribute("delimeter") == FALSE) return $this;
    	// Validates Keys
        if ($this->validateAttribute("keys") == FALSE) return $this;

        if (!file_exists($logFile)):
			$this->error = "Specified file: '$logFile' doesn't exist.";
			return $this;
		endif;

	    $logs 	= [];
	    $handle = fopen($logFile, "r");
	    if (!$handle):
			$this->error 		= "Error opening the file '$logFile'.";
			$this->readResult 	= [];
			return $this;
	    endif;
        while (($line = fgets($handle)) !== FALSE)
        {
        	if (!empty(trim($line))):
	            $logObject  	= (object) [];
	            $logAttributes 	= explode($delimeter, $line);
	            for ($i = 0; $i < count($keys); $i++):
	                $key 				= $keys[$i] 			?? "";
	                $logAttribute 		= $logAttributes[$i] 	?? "";
	                $logObject->$key 	= trim($logAttribute);
	            endfor;
	            $logs[] = $logObject;
	        endif;
        }
        fclose($handle);
        $order = empty($order) || !in_array(strtolower($order), ['asc', 'desc']) ? "desc" : strtolower($order);
        if (!empty($logs) && $order == "desc") krsort($logs);
		$this->readResult 		= $logs;
		$this->filteredResult 	= $logs;
		$this->result 			= $logs;
		return $this;
    }
1327947
public function logDebug($message)
    {
        if ( ! Mage::helper('turpentine/varnish')->getVarnishDebugEnabled()) {
            return;
        }

        if (func_num_args() > 1) {
            $message = $this->_prepareLogMessage(func_get_args());
        }

        return $this->_log(Zend_Log::DEBUG, $message);
    }
247525
public function readString($delim = "\x00")
    {

        // Get position of delimiter
        $len = strpos($this->data, $delim, min($this->index, $this->length));

        // If it is not found then return whole buffer
        if ($len === false) {
            return $this->read(strlen($this->data) - $this->index);
        }

        // Read the string and remove the delimiter
        $string = $this->read($len - $this->index);
        ++$this->index;

        return $string;
    }
276860
private function processLogin (DeligatedUser $deligatedUser, $email, $password)
	{
		$mapper = \Neuron\MapperFactory::getUserMapper ();
		ExpectedType::check ($mapper, UserMapper::class);

		$user = $mapper->getFromLogin ($email, $password);

		if ($user)
		{
			// Everything okay

			// Link the deligated user to this user.
			$deligatedUser->setUser ($user);
			MapperFactory::getDeligatedMapper ()->update ($deligatedUser);

			return $this->module->login ($this->request, $user);
		}

		else {
			// Check if we have this email address
			$user = $mapper->getFromEmail ($email);
			if ($user)
			{
				return 'PASSWORD_INCORRECT';
			}
			else {
				return 'USER_NOT_FOUND';
			}
		}
	}
706775
public function segment($delimiter, $index) {
        $parts = $this->split($delimiter);
        $returnValue = (isset($parts[$index - 1])) ? $parts[$index - 1] : '';

        return $this->createClone($returnValue);
    }
918354
public function decryptMessage($message)
    {
        $calgo = $this->config->getCipherAlgorithm();
        $cmode = $this->config->getCipherMode();
        $malgo = $this->config->getHmacAlgorithm();
        
        $size = mcrypt_get_iv_size($calgo, $cmode);
        $keySize = mcrypt_get_key_size($calgo, $cmode);
        $hmacSize = strlen(hash_hmac($malgo, '', 'foo-key', true));

        $cmac = substr($message, -1 * $hmacSize);
        $iv = substr($message, 0, $size);
        $cipherText = substr($message, $size, -1 * $hmacSize);
        $hmac = hash_hmac($malgo, $iv . $cipherText, $this->computeCipherKey($this->config->getHmacKey(), $hmacSize, $iv), true);
        
        if(!SecurityUtil::timingSafeEquals($hmac, $cmac))
        {
            throw new IntegrityCheckFailedException('Invalid encrypted input message detected');
        }
        
        $key = $this->computeCipherKey($this->config->getCipherKey(), $keySize, $iv);
        $data = mcrypt_decrypt($calgo, $key, $cipherText, $cmode, $iv);
        
        // PKCS7 Padding
        $pad = ord($data[strlen($data) - 1]);
        $data = substr($data, 0, -1 * $pad);
        
        // Remove zero-byte padding from the string.
        return $data;
    }
206831
public static function decodeMessage(string $message): Message
    {
        $offset = 0;
        $header = self::decodeHeader($message, $offset);
        $messageObject = new Message($header);
        $messageObject->setQuestions(self::decodeResourceRecords($message, $header->getQuestionCount(), $offset, true));
        $messageObject->setAnswers(self::decodeResourceRecords($message, $header->getAnswerCount(), $offset));
        $messageObject->setAuthoritatives(self::decodeResourceRecords($message, $header->getNameServerCount(), $offset));
        $messageObject->setAdditionals(self::decodeResourceRecords($message, $header->getAdditionalRecordsCount(), $offset));

        return $messageObject;
    }
1341247
public function readStringMulti($delims, &$delimfound = null)
    {

        // Get position of delimiters
        $pos = [];
        foreach ($delims as $delim) {
            if ($p = strpos($this->data, $delim, min($this->index, $this->length))) {
                $pos[] = $p;
            }
        }

        // If none are found then return whole buffer
        if (empty($pos)) {
            return $this->read(strlen($this->data) - $this->index);
        }

        // Read the string and remove the delimiter
        sort($pos);
        $string = $this->read($pos[0] - $this->index);
        $delimfound = $this->read();

        return $string;
    }
312640
public function log($message, $args, $priority='LOG_INFO')
    {
        if (array_key_exists('FILENAME', $args) === false) {
            $backtrace        = debug_backtrace();
            $args['FILENAME'] = $backtrace[0]['file'];
            $args['LINENO']   = $backtrace[0]['line'];
        }//end if

        $newArgs   = array();
        $fileParts = explode('/', $args['FILENAME']);
        $newArgs[] = array_pop($fileParts)."#".$args['LINENO'];
        unset($args['LINENO']);
        unset($args['FILENAME']);
        foreach ($args as $arg) {
            $newArgs[] = $arg;
        }//end foreach

        if ($this->_isSecure($message) === true) {
            // TODO: Do not write log
            // Get list of handlers which will process message
            // Send message about which handlers are erroneous.
        } else {
            if (empty($this->_logPatterns)) {
                $this->_logPatterns[Logger::ALL] = new FileLogHandler();
            }//end if

            foreach ($this->_logPatterns as $pattern => $handler) {
                if(preg_match($pattern, $message))
                    $handler->writeLog($message, $priority, $newArgs);
            }//end foreach
        }
    }
1105055
protected function logMiddleware()
    {
        $formatter = new MessageFormatter($this->app['config']['http.log_template'] ?? MessageFormatter::DEBUG);

        return Middleware::log($this->app['logger'], $formatter);
    }
939519
function writeToLog($message) {
		if ($this->logFile) {
			$timestamp = date("Y-m-d H:i:s");
			$timestamp = str_pad($timestamp, 20);
			if (isset($_SERVER["REMOTE_ADDR"])) {
				$ip = $_SERVER["REMOTE_ADDR"];
			} else {
				$ip = "Unknown IP";
			}
			$ip = str_pad($ip, 15);
			$taggedMessage = "$timestamp $ip $message\n";
			file_put_contents($this->logFile, $taggedMessage, FILE_APPEND);
		}
		if ($this->logCallback) {
			call_user_func_array($this->logCallback, array($message));
		}
	}
230210
public function formatLog(array $logMessage) {
        extract($logMessage);

        $level = strtoupper($level);
        $message = $this->applyContext($message, $context);
        $timestamp = date($this->dateTimeFormat, $timestamp);
        $exception = $this->getExceptionTrace($context);

        $log = str_replace(self::FORMAT_TIMESTAMP, $timestamp, $this->logFormat);
        $log = str_replace(self::FORMAT_LEVEL, $level, $log);
        $log = str_replace(self::FORMAT_MESSAGE, $message, $log);
        $log = str_replace(self::FORMAT_EXCEPTION, $exception, $log);

        return $log;
    }
927695
private function createRpbMessage(DeleteRequest $request)
    {
        $rpbDelReq = new RpbDelReq();

        $rpbDelReq->setBucket($request->bucket);
        $rpbDelReq->setType($request->type);
        $rpbDelReq->setKey($request->key);

        if ($request->r !== null) {
            $rpbDelReq->setR($this->encodeQuorum($request->r));
        }

        if ($request->pr !== null) {
            $rpbDelReq->setPr($this->encodeQuorum($request->pr));
        }

        if ($request->w !== null) {
            $rpbDelReq->setW($this->encodeQuorum($request->w));
        }

        if ($request->rw !== null) {
            $rpbDelReq->setRw($this->encodeQuorum($request->rw));
        }

        if ($request->dw !== null) {
            $rpbDelReq->setDw($this->encodeQuorum($request->dw));
        }

        if ($request->pw !== null) {
            $rpbDelReq->setPw($this->encodeQuorum($request->pw));
        }

        if ($request->vClock !== null) {
            $rpbDelReq->setVclock($request->vClock);
        }

        return $rpbDelReq;
    }
1256680
function writeToTraceLog($message) {
		if ($this->traceLogFile) {
			$timestamp = date("Y-m-d H:i:s");
			$timestamp = str_pad($timestamp, 20);
			if (isset($_SERVER["REMOTE_ADDR"])) {
				$ip = $_SERVER["REMOTE_ADDR"];
			} else {
				$ip = "Unknown IP";
			}
			$ip = str_pad($ip, 15);
			$taggedMessage = "$timestamp $ip $message\n";
			file_put_contents($this->traceLogFile, $taggedMessage, FILE_APPEND);
		}
		if ($this->traceLogCallback) {
			call_user_func_array($this->traceLogCallback, array($message));
		}
	}