private function writeLog($msg, $code = 10000) { $body = "UpaddException\n"; $body .= "--\n"; $body .= "Msg:" . $msg . "\n"; $body .= "Code:" . $code . "\n"; $body .= "--\n"; Log::run($body); }
/** * 请求日志 * @pamer */ private function setRequestLog() { $_header = getHeader(); $Requset = ''; if (is_run_evn()) { if (isset($_SERVER['REQUEST_URI'])) { $Requset = $_SERVER['REQUEST_URI']; } } else { $Requset = 'cli'; } $body = 'Run Start' . "\n"; $body .= 'Host:' . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '') . "\n"; $body .= 'Requset:' . $Requset . "\n"; $body .= 'Ip:' . getClient_id() . "\n"; $body .= 'Method:' . (isset($_SERVER["REQUEST_METHOD"]) ? $_SERVER["REQUEST_METHOD"] : 'cli') . "\n"; $body .= 'Header:' . json($_header) . "\n"; $body .= 'Parameter:' . json(Data::all()) . "\n"; Log::run($body); }
/** * 记录SQL错误 */ public function log() { Log::run($this->_sql . "\n"); }
/** * 正常退出 */ public static function setExit() { /** * type,message,fileline */ $error = error_get_last(); if ($error) { /** * 检测是否有错误 */ if (is_null($error) === false) { //待处理全局致命类型错误 if (in_array($error['type'], static::$errorType)) { } } self::printError($error); } $endtime = "Date:" . date('Y/m/d H:i:s') . "\n"; $time = microtime(true) - RUNTIME; $endtime .= 'End Run Time consuming ' . round($time, 3) . ' second'; $endtime .= "\r\n" . "======\n\r"; Log::run($endtime); }