logs)) { return; } foreach ($this->logs as $method => $message) { $this->write($message, $method); } $this->logs = []; } /** * @param Throwable $exception * @return mixed * @throws Exception */ public function exception(Throwable $exception): mixed { $code = $exception->getCode() == 0 ? 500 : $exception->getCode(); $logger = Kiri::app()->getLogger(); $logger->write(jTraceEx($exception), 'exception'); return Json::to($code, $exception->getMessage(), [ 'file' => $exception->getFile(), 'line' => $exception->getLine() ]); } }