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);
/** @var ConfigProvider $config */
$config = instance(ConfigProvider::class, [sweep(APP_PATH . '/config')]);
$config = make(ConfigProvider::class);
$this->mapping($config);
$this->parseStorage($config);
+11 -2
View File
@@ -44,6 +44,9 @@ class Logger implements LoggerInterface
private array $levels = [];
/**
*
*/
public function __construct()
{
$this->levels = \config('log.level', Logger::LOGGER_LEVELS);
@@ -176,8 +179,14 @@ class Logger implements LoggerInterface
return;
}
$console = Kiri::getDi()->get(OutputInterface::class);
$console->writeln($_string);
$container = Kiri::getDi();
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/');
file_put_contents($filename, $_string, FILE_APPEND);