refactor: documents
All checks were successful
JS Unit Tests / test (pull_request) Successful in 21s
Build Test / build (pull_request) Successful in 25s
PHP Unit Tests / test (pull_request) Successful in 46s

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-03-03 22:13:36 -05:00
parent 85e89dca87
commit 1f3e87535b
45 changed files with 1667 additions and 676 deletions

View File

@@ -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),