This commit is contained in:
2021-02-20 13:08:54 +08:00
parent d05cb47f66
commit 163c823d25
6 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ class Application extends HttpService
*/ */
protected function write($message, $category = 'app') protected function write($message, $category = 'app')
{ {
$logger = Snowflake::app()->logger; $logger = Snowflake::app()->getLogger();
$logger->write($message, $category); $logger->write($message, $category);
$logger->insert(); $logger->insert();
} }
+1 -1
View File
@@ -33,7 +33,7 @@ class Command extends \Console\Command
*/ */
public function onHandler(Input $dtl): string public function onHandler(Input $dtl): string
{ {
$manager = Snowflake::app()->server; $manager = Snowflake::app()->getServer();
$manager->setDaemon($dtl->get('daemon', 0)); $manager->setDaemon($dtl->get('daemon', 0));
if (!in_array($dtl->get('action'), self::ACTIONS)) { if (!in_array($dtl->get('action'), self::ACTIONS)) {
+1 -1
View File
@@ -88,7 +88,7 @@ class OnRequest extends Callback
$response->end($message); $response->end($message);
} }
} catch (\ErrorException $exception) { } catch (\ErrorException $exception) {
$logger = Snowflake::app()->logger; $logger = Snowflake::app()->getLogger();
$logger->write($exception->getMessage(), 'shutdown'); $logger->write($exception->getMessage(), 'shutdown');
} finally { } finally {
unset($response); unset($response);
+1 -1
View File
@@ -20,7 +20,7 @@ return [
], ],
'events' => [ 'events' => [
Event::SERVER_WORKER_START => function () { Event::SERVER_WORKER_START => function () {
$router = Snowflake::app()->router; $router = Snowflake::app()->getRouter();
$router->loadRouterSetting(); $router->loadRouterSetting();
}, },
] ]
+3 -3
View File
@@ -55,7 +55,7 @@ class Config extends Component
*/ */
public static function get($key, $try = FALSE, $default = null): mixed public static function get($key, $try = FALSE, $default = null): mixed
{ {
$instance = Snowflake::app()->config->getData(); $instance = Snowflake::app()->getConfig()->getData();
if (!str_contains($key, '.')) { if (!str_contains($key, '.')) {
return isset($instance[$key]) ? $instance[$key] : $default; return isset($instance[$key]) ? $instance[$key] : $default;
} }
@@ -85,7 +85,7 @@ class Config extends Component
*/ */
public static function set($key, $value): mixed public static function set($key, $value): mixed
{ {
$config = Snowflake::app()->config; $config = Snowflake::app()->getConfig();
return $config->setData($key, $value); return $config->setData($key, $value);
} }
@@ -96,7 +96,7 @@ class Config extends Component
*/ */
public static function has($key, $must_not_null = false): bool public static function has($key, $must_not_null = false): bool
{ {
$config = Snowflake::app()->config; $config = Snowflake::app()->getConfig();
if (!isset($config->data[$key])) { if (!isset($config->data[$key])) {
return false; return false;
} }
+1 -1
View File
@@ -242,7 +242,7 @@ class Logger extends Component
$code = $exception->getCode() == 0 ? 500 : $exception->getCode(); $code = $exception->getCode() == 0 ? 500 : $exception->getCode();
$logger = Snowflake::app()->logger; $logger = Snowflake::app()->getLogger();
$string = 'Exception: ' . PHP_EOL; $string = 'Exception: ' . PHP_EOL;
$string .= '#. message: ' . $errorInfo['message'] . PHP_EOL; $string .= '#. message: ' . $errorInfo['message'] . PHP_EOL;