Exemple #1
0
 /**
  * Output the message
  *
  * @param $msg string output the string
  *
  * @return ChannelAbstract
  */
 public function write($msg)
 {
     $msg = $this->prepareMessage($msg);
     if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
         printf('%s' . PHP_EOL, $msg);
     } else {
         if (class_exists('\\cli\\Streams')) {
             \cli\err($msg);
         } else {
             fwrite(STDERR, $msg . PHP_EOL);
         }
     }
     parent::written();
 }
Exemple #2
0
 /**
  * Output the string to the HTML channel
  *
  * @param $msg string output the string
  *
  * @return ChannelAbstract
  */
 public function write($msg)
 {
     if ($this->isBasicHttpClient) {
         $msg = $this->prepareMessage($msg);
         printf("%s\n", $msg);
     } else {
         $arr = array();
         if ($this->bAddTimestamp) {
             $arr['timestamp'] = date('Y/m/d H:i:s');
         }
         foreach ($this->aMessageFields as $pfxName => $pfxValue) {
             if ($pfxName == 'timestamp') {
                 continue;
             } else {
                 $arr[$pfxName] = $pfxValue;
             }
         }
         $arr['message'] = $msg;
         $this->aCachedMessages[] = $arr;
     }
     parent::written();
 }
Exemple #3
0
 /**
  * Write the output to the console
  *
  * @param $msg string output the string
  *
  * @return ChannelAbstract
  */
 public function write($msg)
 {
     $msg = $this->prepareMessage($msg);
     if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
         printf('%s' . PHP_EOL, $msg);
     } else {
         if ($this->useStream && !is_null($this->level)) {
             \cli\line($msg);
         } else {
             print $msg . PHP_EOL;
         }
     }
     parent::written();
 }