if (file_exists($old_name)) { rename($old_name, $new_name); } } function do_update_file() { $file_1 = $this->iTag_logroot . "web.1"; $file_2 = $this->iTag_logroot . "web.2"; $file_3 = $this->iTag_logroot . "web.3"; $file_4 = $this->iTag_logroot . "web.4"; if (file_exists($file_4)) { unlink($file_4); } $this->rename_file($file_3, $file_4); $this->rename_file($file_2, $file_3); $this->rename_file($file_1, $file_2); $this->rename_file($this->iLog_fpath, $file_1); } } // 设置全局日志对象 $log = NULL; // 全局日志对象 // 日志级别(从低到高):iLOG_INFO,iLOG_WARNING,iLOG_ERROR $api_k = 'QST'; $log = new iLog(0, $api_k, iLOG_INFO); // 若要关闭日志,只需要把此行注释掉 if ($log) { $log->start(); } //set_ilog(ifile_name(__FILE__)); ilog(iLOG_INFO, "<--------- start --------->", __LINE__);
function ilog($rank, $_log, $line = "-") { global $log; if (!$log) { $log = new iLog(0, 'qst', iLOG_INFO); if ($log) { $log->start(); } set_ilog(ifile_name(__FILE__)); } if ($log) { $log->tag_line($line); $log->log($rank, $_log); } }