Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 73cb94f657 | |||
| b3ea8978b1 | |||
| 008a0914eb | |||
| 01f8e16b38 |
@@ -8,9 +8,7 @@ use Exception;
|
|||||||
use HttpServer\Abstracts\HttpService;
|
use HttpServer\Abstracts\HttpService;
|
||||||
use HttpServer\Controller;
|
use HttpServer\Controller;
|
||||||
use HttpServer\Exception\RequestException;
|
use HttpServer\Exception\RequestException;
|
||||||
use HttpServer\Http\Context;
|
|
||||||
use HttpServer\Http\Request;
|
use HttpServer\Http\Request;
|
||||||
use HttpServer\Http\Response;
|
|
||||||
use HttpServer\IInterface\Middleware;
|
use HttpServer\IInterface\Middleware;
|
||||||
use HttpServer\IInterface\RouterInterface;
|
use HttpServer\IInterface\RouterInterface;
|
||||||
use JetBrains\PhpStorm\Pure;
|
use JetBrains\PhpStorm\Pure;
|
||||||
@@ -506,7 +504,7 @@ class Router extends HttpService implements RouterInterface
|
|||||||
{
|
{
|
||||||
$node = $this->find_path(\request());
|
$node = $this->find_path(\request());
|
||||||
if (!($node instanceof Node)) {
|
if (!($node instanceof Node)) {
|
||||||
throw new RequestException(self::NOT_FOUND, 404);
|
throw new RequestException(\request()->getUri() . ' -> ' . self::NOT_FOUND, 404);
|
||||||
}
|
}
|
||||||
send(($response = $node->dispatch()), 200);
|
send(($response = $node->dispatch()), 200);
|
||||||
if (!$node->hasAfter()) {
|
if (!$node->hasAfter()) {
|
||||||
|
|||||||
+14
-14
@@ -39,7 +39,7 @@ class Logger extends Component
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $message
|
* @param mixed $message
|
||||||
* @param string $method
|
* @param string $method
|
||||||
* @param null $file
|
* @param null $file
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
@@ -51,18 +51,18 @@ class Logger extends Component
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $message
|
* @param mixed $message
|
||||||
* @param string $method
|
* @param string $method
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function trance($message, $method = 'app')
|
public function trance(mixed $message, string $method = 'app')
|
||||||
{
|
{
|
||||||
$this->writer($message, $method);
|
$this->writer($message, $method);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $message
|
* @param mixed $message
|
||||||
* @param string $method
|
* @param string $method
|
||||||
* @param null $file
|
* @param null $file
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
@@ -73,12 +73,12 @@ class Logger extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $message
|
* @param mixed $message
|
||||||
* @param string $method
|
* @param string $method
|
||||||
* @param null $file
|
* @param null $file
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function success(mixed $message, $method = 'app', $file = null)
|
public function success(mixed $message, string $method = 'app', $file = null)
|
||||||
{
|
{
|
||||||
$this->writer($message, $method);
|
$this->writer($message, $method);
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ class Logger extends Component
|
|||||||
* @return string
|
* @return string
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function writer($message, $method = 'app'): string
|
private function writer($message, string $method = 'app'): string
|
||||||
{
|
{
|
||||||
$this->print_r($message, $method);
|
$this->print_r($message, $method);
|
||||||
if ($message instanceof Throwable) {
|
if ($message instanceof Throwable) {
|
||||||
@@ -114,10 +114,10 @@ class Logger extends Component
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $message
|
* @param $message
|
||||||
* @param $method
|
* @param string $method
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function print_r($message, $method = '')
|
public function print_r($message, string $method = '')
|
||||||
{
|
{
|
||||||
$debug = Config::get('debug', ['enable' => false]);
|
$debug = Config::get('debug', ['enable' => false]);
|
||||||
if ((bool)$debug['enable'] === true) {
|
if ((bool)$debug['enable'] === true) {
|
||||||
@@ -145,7 +145,7 @@ class Logger extends Component
|
|||||||
* @param string $application
|
* @param string $application
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getLastError($application = 'app'): mixed
|
public function getLastError(string $application = 'app'): mixed
|
||||||
{
|
{
|
||||||
$filetype = [];
|
$filetype = [];
|
||||||
foreach ($this->logs as $key => $val) {
|
foreach ($this->logs as $key => $val) {
|
||||||
@@ -161,14 +161,14 @@ class Logger extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $messages
|
* @param string $messages
|
||||||
* @param string $method
|
* @param string $method
|
||||||
* @throws
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function write(string $messages, $method = 'app')
|
public function write(string $messages, string $method = 'app')
|
||||||
{
|
{
|
||||||
if (empty($messages)) {
|
|
||||||
return;
|
return;
|
||||||
|
if (empty($messages)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileName = 'server-' . date('Y-m-d') . '.log';
|
$fileName = 'server-' . date('Y-m-d') . '.log';
|
||||||
|
|||||||
Reference in New Issue
Block a user