refactor: documents
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -21,7 +21,8 @@ use KTXC\Injection\Container;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use KTXC\Module\ModuleManager;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use KTXC\Logger\FileLogger;
|
||||
use KTXC\Logger\LoggerFactory;
|
||||
use KTXC\Logger\TenantAwareLogger;
|
||||
use KTXF\Event\EventBus;
|
||||
use KTXF\Cache\EphemeralCacheInterface;
|
||||
use KTXF\Cache\PersistentCacheInterface;
|
||||
@@ -87,10 +88,8 @@ class Kernel
|
||||
$_SERVER['SHELL_VERBOSITY'] = 3;
|
||||
}
|
||||
|
||||
// Create logger with config support
|
||||
$logDir = $this->config['log.directory'] ?? $this->getLogDir();
|
||||
$logChannel = $this->config['log.channel'] ?? 'app';
|
||||
$this->logger = new FileLogger($logDir, $logChannel);
|
||||
// Create logger from config (driver + level-filter; per-tenant wrapping applied later in DI)
|
||||
$this->logger = LoggerFactory::create($this->config, $this->folderRoot());
|
||||
|
||||
$this->initializeErrorHandlers();
|
||||
|
||||
@@ -396,8 +395,23 @@ class Kernel
|
||||
// Without this alias, PHP-DI will happily autowire a new empty Container when asked
|
||||
Container::class => \DI\get(ContainerInterface::class),
|
||||
|
||||
// Use the kernel's logger instance
|
||||
LoggerInterface::class => \DI\value($this->logger),
|
||||
LoggerInterface::class => function (ContainerInterface $c) use ($projectDir) {
|
||||
$logConfig = $this->config['log'] ?? [];
|
||||
|
||||
$logDir = $logConfig['path'] ?? ($projectDir . '/var/log');
|
||||
$channel = $logConfig['channel'] ?? 'app';
|
||||
$level = $logConfig['level'] ?? 'debug';
|
||||
$perTenant = (bool) ($logConfig['per_tenant'] ?? false);
|
||||
|
||||
return new TenantAwareLogger(
|
||||
$this->logger,
|
||||
$c->get(SessionTenant::class),
|
||||
$logDir,
|
||||
$channel,
|
||||
$level,
|
||||
$perTenant,
|
||||
);
|
||||
},
|
||||
|
||||
// EventBus as singleton for consistent event handling
|
||||
EventBus::class => \DI\create(EventBus::class),
|
||||
|
||||
Reference in New Issue
Block a user