예제 #1
0
 /**
  * 获取Yun_Log实例
  *
  * @return Yun_Log
  */
 public static function getInstance()
 {
     if (null === self::$instance) {
         self::$request_id = php_uname('n') . '-' . getmypid() . '-' . microtime(true);
         self::$instance = new Yun_Log();
     }
     return self::$instance;
 }
예제 #2
0
 public function log($message)
 {
     if (null === $this->fp) {
         $this->fp = fopen($this->log_file_path, 'a');
         if (!$this->fp) {
             $this->error_code = -1;
             $this->error_info = "cannot open log file {$log_file_path}";
             Yun_Log::getInstance()->warning($this->error_info);
             return false;
         }
     }
     fwrite($this->fp, $message);
     return true;
 }