示例#1
0
文件: Log.php 项目: Keyzanh/Crawler
 /**
  * Write the content to each file's descriptors of a given
  * channel. If content is an array, it'll be tranformed
  * into a string.
  *
  * @param string
  * @param mixed
  */
 protected function _log($channel, $content)
 {
     if (gettype($content) == 'array') {
         $content = print_r($content, true);
     }
     if (substr($content, -1) != "\n") {
         $content .= "\n";
     }
     $content = '[' . Date::TimestampToShortDateTime(Date::Now()) . '] ' . $content;
     foreach ($this->channels[$channel] as $fd) {
         fwrite($fd, $content);
     }
     return true;
 }