/**
  * console($text, $exception = false, $exit = false) Output console message
  * @param string $data stdout data
  * @param boolean $exception throwed Eception
  * @param boolean $exit die console out
  * @acceess public
  */
 public function console($data, $exception = false, $exit = false)
 {
     // check if console is usable
     if (true === $this->config['debug']) {
         if (is_array($data) || is_object($data)) {
             Debug::dump($data . '', date('[Y-m-d H:i:s]') . ' [DEBUG]');
             if (isset($this->__log)) {
                 $this->_logger->info($data);
             }
         } else {
             if (!is_resource($data)) {
                 $data = mb_convert_encoding($data, $this->config['encoding']);
             }
             $text = date('[Y-m-d H:i:s]') . '[DEBUG] ' . $data . "\r\n";
             if ($exception) {
                 if ($this->__log) {
                     $this->_logger->crit($text);
                 }
                 throw new Exception\ExceptionStrategy($text);
             } else {
                 if ($this->__log) {
                     $this->_logger->info($text);
                 }
                 echo $text;
             }
         }
         if ($exit) {
             $this->shutdown();
         }
     }
 }
Exemple #2
0
 /**
  * @param  string $msg
  * @return \Zend\Log\Logger
  */
 public function logViolation($msg)
 {
     return $this->logger->crit($msg);
 }