Example #1
0
 function __construct($logFileName = "", $logPath = "")
 {
     if ($logFileName != "") {
         $this->_logFileName = $logFileName . '_' . date("ymd") . ".log";
     } else {
         /**
          * 因访问量增大,改为按小时记录
          * @author terry
          * @version 0.1.0
          * Mon Jul 07 14:59:05 CST 2008
          */
         $this->_logFileName = date("Ymd_H") . ".log";
     }
     $this->_logPath = $logPath == "" ? Watt_Config::getLogPath() : $logPath;
     if (!file_exists($this->_logPath)) {
         mkdir($this->_logPath, 0777, true);
         @chmod($this->_logPath, 0777);
     }
     $this->_hLogFile = fopen($this->_logPath . $this->_logFileName, "a");
     @chmod($this->_logPath . $this->_logFileName, 0766);
     //$this->_startTime = $this->_microtime_float();
     if (defined('APP_START_TIME')) {
         $this->_startTime = (int) (APP_START_TIME * 1000);
     } else {
         $this->_startTime = $this->_microtime_float();
     }
     $this->_lastLogTime = $this->_startTime;
     $this->logerSn = $this->_startTime;
 }