static function getInstance() { if (self::$instance == NULL) { self::$instance = new Gloo_Logger(); } return self::$instance; }
function test_log() { Gloo_Logger::getInstance()->debug('debug.message1'); Gloo_Logger::getInstance()->info('info.message2'); Gloo_Logger::getInstance()->warning('warning.message3'); Gloo_Logger::getInstance()->error('Error.message4'); }
function send($commandData) { //massage $commandData $len = strlen($commandData); // Remove [ && ] $commandData = substr($commandData, 1, $len - 2); $commandData = trim($commandData); //trimmed length $len = strlen($commandData); //haystack,needle $pos1 = strpos($commandData, ","); $name = NULL; $payload = NULL; if ($pos1 !== false) { //payload found $name = substr($commandData, 0, $pos1); $payload = substr($commandData, $pos1 + 1, $len - $pos1 - 1); } else { // No payload case $name = $commandData; } Gloo_Logger::getInstance()->debug("command => {$name}"); Gloo_Logger::getInstance()->debug("payload => {$payload} "); //@todo - process this command and return printer output! $command = UIX_Command_Factory::get($name); return $command->execute($payload); }
function process_command($matches) { Gloo_Logger::getInstance()->debug($matches[0]); // Match is __#_[COMMAND]_#__ $command = $matches[0]; $len = strlen($command); //substring from position 4(0-indexed) and read length-8 // [COMMAND] $command = substr($command, 4, $len - 8); //get web output for this command $output = $this->gp->send($command); return $output; }
function validate() { if ($this->required && empty($this->value)) { array_push($this->errors, $this->display . " is a required field "); } if ($this->checkSize && strlen($this->value) > $this->size) { array_push($this->errors, $this->display . " exceeds maximum allowed length of " . $this->size); } if ($this->doEQ && !empty($this->value)) { if ($this->value != $this->eqvalue) { array_push($this->errors, $this->display . " should be " . $this->eqvalue . " ,please try again!"); } } Gloo_Logger::getInstance()->debug('Form element :: ' . $this->name); Gloo_Logger::getInstance()->debug('size=' . $this->size . ' required?=' . $this->required); //Gloo_Logger::getInstance()->debug('errors?='.Gloo_Util::arr2nlstr($this->errors)); }