This commit is contained in:
xl
2023-05-26 10:06:37 +08:00
parent 1f986439b2
commit 2ddfdc1db4
3 changed files with 15 additions and 6 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ abstract class BaseApplication extends Component
$this->localService = make(LocalService::class); $this->localService = make(LocalService::class);
/** @var ConfigProvider $config */ /** @var ConfigProvider $config */
$config = instance(ConfigProvider::class, [sweep(APP_PATH . '/config')]); $config = make(ConfigProvider::class);
$this->mapping($config); $this->mapping($config);
$this->parseStorage($config); $this->parseStorage($config);
+11 -2
View File
@@ -44,6 +44,9 @@ class Logger implements LoggerInterface
private array $levels = []; private array $levels = [];
/**
*
*/
public function __construct() public function __construct()
{ {
$this->levels = \config('log.level', Logger::LOGGER_LEVELS); $this->levels = \config('log.level', Logger::LOGGER_LEVELS);
@@ -176,8 +179,14 @@ class Logger implements LoggerInterface
return; return;
} }
$console = Kiri::getDi()->get(OutputInterface::class); $container = Kiri::getDi();
$console->writeln($_string); if ($container->has(OutputInterface::class)) {
$console = $container->get(OutputInterface::class);
$console->writeln($_string);
} else {
file_put_contents('php://output', $message . PHP_EOL);
}
$filename = storage('log-' . date('Y-m-d') . '.log', 'log/'); $filename = storage('log-' . date('Y-m-d') . '.log', 'log/');
file_put_contents($filename, $_string, FILE_APPEND); file_put_contents($filename, $_string, FILE_APPEND);
+3 -3
View File
@@ -11,12 +11,12 @@ class ConfigProvider
/** /**
* @param array $config *
*/ */
public function __construct(array $config) public function __construct()
{ {
$this->hashMap = new HashMap(); $this->hashMap = new HashMap();
$this->load($config); $this->load(sweep(APP_PATH . '/config'));
$this->enableEnvConfig(APP_PATH . '.env'); $this->enableEnvConfig(APP_PATH . '.env');
} }